• I have been editing my author pages and want to limit the posts that show to all posts except those with the tag IDed 26. I have two possible loops – neither works quite right:

    ———————————–
    Shows posts by 1 author but with all tags:
    ———————————–

    <!-- The Loop -->
    
        <?php
    
        // The Loop
           if (have_posts()) : while (have_posts()) : the_post();
        ?>
                <li>
                    <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
                    <?php the_title(); ?></a>
                </li>
    
            <?php endwhile;
        else: ?>
                <p><?php _e('There are no recent posts by this author.'); ?></p>
    
            <?php endif; ?>
    
        <!-- End Loop -->

    ———————————–
    Shows posts by all authors (not just the author who’s page we’re on) that are not tagged with ID 26
    ———————————–

    <!-- The Loop -->
    
        <?php
        // The Query
         $args = array( "author=$curauth->ID", 'tag__not_in' => array( 26 ));
         $the_query = new WP_Query( $args );
    
        // The Loop
           if ($the_query->have_posts()) : while ($the_query->have_posts()) : $the_query->the_post();
        ?>
                <li>
                    <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
                    <?php the_title(); ?></a>
                </li>
    
            <?php endwhile;
    
        // Reset Post Data
        wp_reset_postdata();
    
        else: ?>
                <p><?php _e('There are no recent posts by this author.'); ?></p>
    
            <?php endif; ?>
    
        <!-- End Loop -->
  • The topic ‘Limit posts with a specific tag on the author page’ is closed to new replies.