Forums

tag__in not working correctly? (2 posts)

  1. Add1ct3dd
    Member
    Posted 6 months ago #

    Hi,
    I'm trying to modify a theme for my own use, which uses custom posts (portfolio).
    Now i'm wanting to display only ones with certain tags (like a feature).

    Here's the code I've got:

    <?php
    			if ( get_query_var('paged') ) { $paged = get_query_var('paged'); } elseif ( get_query_var('page') ) { $paged = get_query_var('page'); } else { $paged = 1; }
    			$allowedtags = array ( 'video', 'videos', 'photo', 'photos' ) ;
    			$args = array(
    							'post_type' => 'portfolio',
    							'paged' => $paged,
    							'meta_key' => 'portfolio-image',
    							'posts_per_page' => -1
    						);
    			$args = array_merge ( $args, array( 'tag__in' => $allowedtags));
    			query_posts( $args );
    
    			rewind_posts();
    		?>

    However no posts are returned, even though I'm using the correct tags!
    Does anyone have any suggestions as to why it's not working?
    Thanks

  2. alchymyth
    The Sweeper
    Posted 6 months ago #

    reading the codex should answer your question:

    http://codex.wordpress.org/Class_Reference/WP_Query#Tag_Parameters

Reply

You must log in to post.

About this Topic