WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Types not showing up in archive (4 posts)

  1. adam533
    Member
    Posted 4 years ago #

    Hi.
    I have created two custom post types (ex. movies and television). I am using categories for both of these also (same categories used in the blog using the normal posts tab). I created these post types using the Custom Post Type UI plugin.

    My problem is when I click on a category assigned to one of the new posts (ex. category of Horror) it should bring me to a list of all posts with that category. In this case though it is only showing posts that were created the from actual posts tab and not either of the custom posts tabs.

    How do I get WordPress to display the posts created from a Custom Post Type tab as an archive?

  2. nickmorss
    Member
    Posted 4 years ago #

    I also have this problem... most annoying, any one got a fix yet?

    Nick

  3. StevieG
    Member
    Posted 3 years ago #

    Me too. Have you found a way around this yet?

  4. gaco79
    Member
    Posted 3 years ago #

    Hi all, this link might be helpful.

    Specifically this filter, although I removed the if statement to make custom post types show up in taxonomies as well as the front page.

    add_filter( 'pre_get_posts', 'my_get_posts' );
    
    function my_get_posts( $query ) {
        if ( is_home() && false == $query->query_vars['suppress_filters'] )
            $query->set( 'post_type', array( 'post', 'page', 'album', 'movie', 'quote', 'attachment' ) );
    
        return $query;
    }

Topic Closed

This topic has been closed to new replies.

About this Topic