Author parameter of WP Query not displaying results
-
I’m running into a strange issue on a site I’m working on. I have created a custom WP Query object to filter posts by their author, however I’m not seeing any results. If I take the author param out, I am seeing results but specifying an Author ID seems to return nothing.
I also noticed the issue on the Admin panel, when showing all posts, if I click on the Author name (which should filter the list to only show posts created by that author) I see ‘No Posts found’.
I’ve tried turning off all plugins and the issue still exists. I also tried re-installing WP core.
Here’s the custom query I’m using, although because I”m seeing the problem in the WP Admin side as well, the issue seems to be something else…
$myposts_query = array( 'posts_per_page' => '10', 'author' => 1 ); // The Query $the_query = new WP_Query( $myposts_query ); // The Loop if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); the_excerpt(); endwhile; endif;
Any thoughts?
- The topic ‘Author parameter of WP Query not displaying results’ is closed to new replies.