sinanisler logo

WordPress WP Query Loop , WP_Query

WP_Query is the advanced way to get posts, filter posts, and write custom queries.

You can even write a SQL Query in WP_Query request.

Usually query_posts() function enough to filter posts most of the time but sometimes you need to write a more advanced filter that’s where WP_Query comes in.

It works almost same as query_post but a bit different like this;

$query = new WP_Query( array( 'author' => 123 ) );
if ( $query->have_posts() ) {
    // the_title, the_content stufff

} else {
    // no post found




There are so many parameters and advanced ways to use check the codex ->


Leave the first comment