Forums

Impossible to get rid of tags after insertion and then deletion (3 posts)

  1. mariostella
    Member
    Posted 3 years ago #

    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

  2. mariostella
    Member
    Posted 3 years ago #

    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?

  3. mariostella
    Member
    Posted 3 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags