Support » Fixing WordPress » How to remove posts tags in bulk

  • Resolved AtaArticles

    (@ataarticles)


    ataarticles.com

    I have removed unused tags using wp plugin but i have some posts in excess of 12 plus tags which i want to reduce to 3 max.

    Is this possible or do i need to manually go through each post which would take weeks as there are about 50000 plus posts. But not all are with tags.

    It seems you can only remove tags with zero count. But is it possible to remove tags in bulk without deleting the posts

Viewing 14 replies - 1 through 14 (of 14 total)
  • You can delete tags even when assigned to a post and the post does not get deleted.

    Easy to test that.

    Write a post, add a new tag. Then go delete that tag.

    Thread Starter AtaArticles

    (@ataarticles)

    Ok,

    Not sure how i can delete tags with published post.

    I tried as you suggested and created ‘test’ post with tag as ‘Entertainment’.

    http://www.ataarticles.com/business/test/

    Now how do i delete all the post tags without deleting all the posts?

    Goto the Post Tags menu item and delete the tag(s) there.

    Administration > Posts > Post Tags

    Thread Starter AtaArticles

    (@ataarticles)

    Hi

    I was aware of the post tags before but i assume it would delete the post aswell. But it seems to work, thanks.

    Now how can i limit users to 3 tags per post when they try to publish their articles again?

    Do i need to look in loop.php but there is also tag.php aswell.

    Thanks.

    Not sure but you’d need to look at wp_insert_post that uses wp_set_post_tags that uses wp_set_object_terms.

    Thread Starter AtaArticles

    (@ataarticles)

    Hello,

    What i find rather strange is neither single.php (post template) or tag.php has the word ‘tag’ in it.

    Hence trying to search for wp_set_post_tags is futile.

    Now with loop.php i found 5 tags. But referring to the code below you can see it doesn’t have wp_set_post_tags

    —————————————————–

    <?php
    $tags_list = get_the_tag_list( ”, ‘, ‘ );
    if ( $tags_list ):
    ?>
    <span class=”tag-links”>
    <?php printf( __( ‘<span class=”%1$s”>Tagged</span> %2$s’, ‘twentyten’ ), ‘entry-utility-prep entry-utility-prep-tag-links’, $tags_list ); ?>
    </span>

    ————————————————–

    If this is not possible, how can i hide the tags from published post.
    On each post on my site the ‘Twenty Ten’ template seems to show all the tags below post. I tried to delete some coding from above but didn’t seem to work.

    One possible solution for in the loop:

    <?php
    $taxonomy = 'post_tag';
    $args='';
      $terms = wp_get_post_terms($post->ID , $taxonomy, $args);
      if ($terms) {
        $count = 0;
        foreach ( $terms as $term ) {
          $count++;
          if ($count <= 3) {
            echo '<p><a href="' . esc_attr(get_term_link($term, $taxonomy)) . '" title="' . sprintf( __( "View all posts in %s" ), $term->name ) . '" ' . '>' . $term->name.'</a> has ' . $term->count . ' post(s). </p> ';
          }
        }
      }
    ?>
    Thread Starter AtaArticles

    (@ataarticles)

    Hi,

    Did you mean replace the code with your the taxonomy code or to embed below it?

    I tried replacing the code, but the post tags still show but when you click on the tags it gives error message:

    Parse error: syntax error, unexpected T_ENDIF in /home/ata/public_html/wp-content/themes/twentyten/loop.php on line 174

    http://www.ataarticles.com/tag/skin-care/

    Didn’t test this but you’d probably replace this code in loop.php of that theme with the code I listed:

    <?php
    					$tags_list = get_the_tag_list( '', ', ' );
    					if ( $tags_list ):
    				?>
    					<span class="tag-links">
    						<?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
    					</span>
    					<span class="meta-sep">|</span>
    				<?php endif; ?>
    Thread Starter AtaArticles

    (@ataarticles)

    Hi,

    I replaced the new code aswell but similar error:

    Parse error: syntax error, unexpected T_ENDIF in /home/ata/public_html/wp-content/themes/twentyten/loop.php on line 178

    Thread Starter AtaArticles

    (@ataarticles)

    I mean replaced the code you listed before and same errors.

    I’ll let you play with the formatting, but just to give you an idea here’s the loop.php I’m using:

    http://wordpress.pastebin.com/P3ETS3Te

    Thread Starter AtaArticles

    (@ataarticles)

    Ok, will study that code and see if it works out.

    Thanks for your help.

    Thread Starter AtaArticles

    (@ataarticles)

    Ok, i found a nice little plugin which deletes all tags and works great:

    http://blogpig.com/products/nukepig

    Did the job in a few seconds.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘How to remove posts tags in bulk’ is closed to new replies.