No Custom Posts on Author summary p (5 posts)

  1. mdlepage
    Posted 3 years ago #


    There are no custom posts showing on the Author's summary page, even though the author created a custom post.

    Now I had to add this code to my functions.php to get custom posts to show in the main index blog feed
    // add Articles custom post type to home page feed

    add_filter( 'pre_get_posts', 'my_get_posts' );

    function my_get_posts( $query ) {

    if ( ( is_home() && false == $query->query_vars['suppress_filters'] ) || is_feed() )
    $query->set( 'post_type', array( 'post', 'article' ) );

    return $query;

    Is there something similar I have to do to have custom post show up on the author's page?

    Thanks. I do really like this module btw.



  2. AmirHelzer
    Plugin Author

    Posted 3 years ago #

    This really depends on your theme. If the theme is not loading these custom posts, they will not show.

  3. mdlepage
    Posted 3 years ago #


    There must be a few lines of code I can add to functions.php to get this to work. The custom post types work everywhere else on my site, except on the author pages. Any help would be really appreciated. Can you at least point me in the right direction?


  4. mdlepage
    Posted 3 years ago #

    Ok, googled and found a solution. Amir, I might suggest adding it to your FAQ or other documentation.

    To fix the authors page to show custom posts add the following code to your functions.php file. Note the array is used to display multiple post types. If you need to display only one type, remove the array.

    function custom_post_author_archive( &$query )
        if ( $query->is_author )
            $query->set( 'post_type', array( 'post', 'your-custom-type-here' ) );
        remove_action( 'pre_get_posts', 'custom_post_author_archive' ); // run once!
    add_action( 'pre_get_posts', 'custom_post_author_archive' );

    Hope that helps anyone else stuck on this.

  5. AmirHelzer
    Plugin Author

    Posted 3 years ago #

    Thanks for posting the code here. I'm sure that others will find it useful as well.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Types
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic