Skip to content

Instantly share code, notes, and snippets.

@juanfra
Last active June 13, 2019 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanfra/3abb7438322717a5859a to your computer and use it in GitHub Desktop.
Save juanfra/3abb7438322717a5859a to your computer and use it in GitHub Desktop.
Modify the information to display in the Author's archive page.
<?php
//* Do NOT include the opening php tag
// filter the content to display on the Author's archive page
function nice_cpt_author_archive( $query ) {
if ( $query->is_author ) {
$arr_post_types = array( 'post', 'article' ); // Edit this array as you need.
$query->set( 'post_type', $arr_post_types );
}
}
add_action( 'pre_get_posts', 'nice_cpt_author_archive' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment