Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
  • in reply to: Author.php for custom post type #45399
     jorasik
    Participant

    I just managed to do it. It was a small mistake in the function from the first link. Now it works just fine for getting the author posts.

    Here is what I am using, maybe someone else will need it too.

    COPY CODE
    function custom_post_author_archive($query) {
        if ($query->is_author)
            $query->set( 'post_type', array('posttype1', 'posttype2') );
    	return $query;
        remove_action( 'pre_get_posts', 'custom_post_author_archive' );
    	
    }
    add_action('pre_get_posts', 'custom_post_author_archive');
Viewing 1 post (of 1 total)

Log in with your credentials

Forgot your details?