Jump to content


This topic is now archived and is closed to further replies.


Custom post type and author page

Recommended Posts


Hello :)

On my website (which is on locla, so I cannot provide any link), I set a template for the Author pages. Then I created a custom post type, and custom a template for their archives.


I also used this function :

function custom_post_author_archive($query) {
    if ($query->is_author && !is_admin() )
        $query->set( 'post_type', array('event', 'post') );
    remove_action( 'pre_get_posts', 'custom_post_author_archive' );
add_action('pre_get_posts', 'custom_post_author_archive');

in order to get the custom posts and the classic post in the author page.


But adding this action breaks the Athor page : it now displays the custom post type archive template. Without this code, it works properly.

I tried to see where is the problem and it seems that in the function type() in editor.page.php, is_author() returns false even if I am in a Author page. What could I do to fix this problem ?



Share this post

Link to post
Share on other sites