Stream Page Posts not in TAGS' Results

Community Forums Forums Design Tips and Tricks Stream Page Posts not in TAGS' Results

This topic is: not resolved

This topic contains 3 replies, has 2 voices, and was last updated by  francky 2 years, 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #55777


    I have the code below to add a Stream Page in my website but the problem I have is that when accessing a certain TAG Page eg. , a post with tag “election” in the stream doesn’t show up! But if there is any normal blog post with the same tag, it shows up! The problem is only with the “Stream Posts”.
    How can I have this work? Thank you in advance!

    //* Create stream custom post type
    add_action( 'init', 'stream_post_type' );
    function stream_post_type() {
        register_post_type( 'stream',
                'labels' => array(
                    'name' => __( 'The Stream' ),
                    'singular_name' => __( 'Stream' ),
                'has_archive' => true,
                'hierarchical' => true,
                'taxonomies' => array( 'post_tag' ),
                'public' => true,
                'rewrite' => array( 'slug' => 'stream' ),
                'supports' => array( 'title', 'editor', 'custom-fields', 'genesis-seo', 'thumbnail', 'comments' ),
    http://tags, stream page, stream


    Anyone who can help me with this please?



    by default, the tag archive page won’t include any post type other than posts. you need to include your post type in there with a pre_get_posts filter. This code should do it.

    function stream_to_tag_loop( $query ) {
    	// we don't want this running on the admin side
    	if ( is_admin() )
    	// include our stream type on tag pages
    	if ( is_tag() && $query->is_main_query() ) {
    		$query->query_vars['post_type']	= array( 'post', 'stream' );
    add_action ( 'pre_get_posts', 'stream_to_tag_loop' );


    WoW!! PERFECT!
    It worked like a charm! WoW!

    Thank you very much @Norcross

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.