Displaying Custom Post Types in Author Archives
-
I am trying to display multiple custom post types in an author archive page, but can’t seem to get both a CPT and post to display (handled by loops in elementor). I can only get one or the other, and only one CPT.
I have been able to get my singular CPT to display using the code provided:
function wpse107459_add_cpt_author( $query ) { if ( is_admin() || ! $query->is_main_query() ) { return; } if ( $query->is_author() ) { $query->set( 'post_type', array( 'MY_CPT_1' ) ); } } add_action( 'pre_get_posts', 'wpse107459_add_cpt_author' );Where do I go from here to get this to work with multiple custom post types and the posts?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Displaying Custom Post Types in Author Archives’ is closed to new replies.