Answer the question
In order to leave comments, you need to log in
Why is the post ID 0?
I'm trying to display all products in a category
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
var_dump($post);
}
}
object(WP_Post)#13091 (24) {
["ID"]=>
int(0)
["post_author"]=>
string(1) "1"
["post_date"]=>
string(19) "2018-04-17 08:53:16"
["post_date_gmt"]=>
string(19) "2018-04-17 05:53:16"........
Answer the question
In order to leave comments, you need to log in
I did not notice, it turns out that WC gave me not a post, but a category. Moreover, it looks like a post, and the WP_post class. I do not understand how the hierarchy in WC works.
Check if you have wp_reset_postdata() on the main page after the loop
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question