• mariostella

    (@mariostella)


    Hi
    I need tags to decide the display of certain elements depending on the post type. If I’ve never inserted the tag in the post the element is not displayed as it should. If I insert the tag, wishing the element to be displayed, it works as it should. The problem is when I do not want the element to be displayed anymore. I remove the tag, but the query still finds the tag associated with the post and displays the element nevertheless. How can I avoid it doing this?

    The query I use is the following

    <?php
    $tags = 'show-gal'; // separate multiple tags with comma
    $numposts = '1'; // -1 for all
    $myquery = new WP_Query("tag=$tags&amp;showposts=$numposts");?>
    <?php if($myquery->have_posts()) : ?>
    
    				do my stuff
    
    <?php endif; ?>

    Thanks for your help

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter mariostella

    (@mariostella)

    Hi,
    I need to correct my entry. The problem seems to be with the query, not with the tags. I am using the same query to list posts that have a certain tag only. I tested that query removing the tag and then reinserting it, and the post was removed then reinserted in the list.

    So maybe it is just the properties of the query which are wrong. Anyone would like to help with this?

    Thread Starter mariostella

    (@mariostella)

    What would be the appropriate query? I have searched all the forums but I am not able to get the right query for this. I tried with has_tag(‘show-gal’) to no avail. Anyone on this please?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Impossible to get rid of tags after insertion and then deletion’ is closed to new replies.