I am trying to create an author.php page that calls custom post types by the author appearing on that page. My problem is that when using the code below -- which filters for the post type 'video' -- the code outputs all custom post types, not just 'video'. The caveat is when I remove the array's author key and variable 'author' => $author
which then has the effect of allowing the code to output the desired custom post type 'video' but from every author. Any ideas of how to fix this?
Code used:
<?php
$args = array(
'post_type' => array( 'audio' ),
'posts_per_page' => 10,
'author' => $author
);
$author_videos = new WP_Query( $args );
if ( $author_videos->have_posts() ) : while ( $author_videos->have_posts() ) : $author_videos->the_post(); ?>
<p><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></p>
<?php endwhile;
wp_reset_postdata();
endif; ?>
$author
? Also: you have'post_type' => array( 'audio' )
, rather thanvideo
. Is that a typo?