Get user posts with custom WP_Query on author.php
I try to show custom post list with WP_Query on author.php like this:
?php $args = array( 'post_type' = 'post', 'author' = 'get_queried_object_id()', 'posts_per_page' = 9 );
$the_query = new WP_Query( $args );
if ( $the_query-have_posts() ) :
while ( $the_query-have_posts() ) : $the_query-the_post(); ?
figurea href=?php the_permalink(); ?img src=?php if ( has_post_thumbnail() ) : the_post_thumbnail(); endif; ? alt=?php the_title(); ?/a/figure
h5a href=?php the_permalink(); ??php the_title(); ?/a/h5
?php endwhile; wp_reset_postdata(); ?
?php else : ?
p?php _e( 'No posts by this author' ); ?/p
?php endif; ?
It gives posts from all authors for some reason. I've tried different combinations of 'author' array element with no luck or some other errors/issues (like displaying only one post for example).
Please help to solve this issue.
Topic wp-query author-template Wordpress
Category Web