• Hi, I been using one plugin that assigns tags to posts containing specific text strings comparing with external file when I press de PUBLISH button. When I make changes from an old post and push UPDATE the new text append new tags to the post. And the old ones still on it. I need to know how modify this code to make posible the erase of old tags before to put the new ones. I read all information in codex.wordpress.org and nothing help me. I looking on the web and only get this http://wordpress.stackexchange.com/questions/49248/remove-tags-from-posts-in-php and this url http://stackoverflow.com/questions/3356380/wordpress-delete-all-tags-by-post-id but when I use this codes nothing happend or just get an error massage.

    • add_action( 'save_post', 'jpl_docs_autotag' );
      function jpl_docs_autotag($post_id) {
          $post = get_post($post_id);
          if ( intval($post->ID) > 0 ) {
      
      // HERE IS WHERE I PUT THE CODE THAT I´VE TRIED
      
      		$options = get_option( 'docs_autotags' );
      		if ( count($options) > 0 ) {
      			foreach ( $options as $pattern => $tags ) {
      				if ( strpos($post->post_content, $pattern) )
      					wp_set_post_tags( $post->ID, $tags, TRUE ); // TRUE means append
      			}
      		}
          }
      }

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • AW a11n

    (@slash1andy)

    Automattic Happiness Engineer

    Hello there,

    Honestly, it sounds like you are having an issue with the plugin, so your best bet would be to contact the support team for that plugin.

    Cheers,
    Andrew

    Thread Starter aeroexodus

    (@aeroexodus)

    Hello Andrew

    The plugin works perfectly. I want this function only for my own specific need. Unfortunately also the last response from the creator of the plugin was a year ago. He is gone and doesn´t give any support to no one. You can check this information here http://wordpress.org/support/plugin/docs-auto-tags

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove all the old tags in post using code.’ is closed to new replies.