Forums

[resolved] WordPress Tag filtering not working as should (2 posts)

  1. paulsanduleac
    Member
    Posted 1 year ago #

    I am using 7 different queries in my template with the following code (each one with different categories)

    <?php
     $lastposts = get_posts('numberposts=1&category_name=music');
     foreach($lastposts as $post) :
        setup_postdata($post);
     ?>
     <?php the_content(); ?>
     <?php endforeach; ?>

    I have set the permalinks right, and put the Tag Base as 'tag', but when I try to access http://blogurl.com/tag/old the content does not change, even though it is different from the home page.

    I also tried on another page (same template) the wp_dropdown_categories and the elements of the list did not change anything.

    Could this be because of the number of queries? How do I fix this?

  2. paulsanduleac
    Member
    Posted 1 year ago #

    Figured it out: the "get_posts" works only with the main loop, it's not supposed to use for multiple loops. Will try the "WP_query".

Topic Closed

This topic has been closed to new replies.

About this Topic