Exclude comments from a WP_Query object?

Did you actually find a case where there are any real comments in the wp-query object after running a normal query? If you examine the code in class-wp-query.php, you should find that the comments field only is populated with comments when a “comments-feed” is being queried for. In normal operation, comments are not retrieved by … Read more

$wp_query initiation?

User Rarst has a very famous answer where he lays out the load process. Looking at this graph whenever wp-blog-header.php gets loaded it calls function wp() which sets up many of WordPress globals like $post and $wp_query. ( Secondary Reference by User Gmazzap ) That’s the technical side of things but it looks like the … Read more

How to stop wordpress to make the default query?

Stop WordPress to run main query is hard: you have to dig inside the deep heart of WordPress. WordPress frontend workflow: wp-blog-header.php call the function wp() wp() function creates an instance of wp class, and call main() method on it main() method code: public function main($query_args=””) { $this->init(); $this->parse_request($query_args); // build query vars starting from … Read more

What kind of object type is WP_Query?

I’m not sure you understand the logic of WP_Query. Rather than explain in words, here’s a code example; $query = new WP_Query( array( ‘meta_key’ => ‘Old ID’, ‘meta_value’ => $atts[‘oldid’] ) ); if ( $query->have_posts() ) return $query->posts[0]->post_title; return ”; Check out the codex on interacting with WP_Query. UPDATE: To use the query as you … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)