Skip to content
WJunction - Webmaster Forum

WP auto tag plugin

Status
Not open for further replies.
hi, i'm looking for a plugin which generates automatically tags for my posts.. daily i have over 200 posts so its difficult to manage them manually.

cheers
 

9 comments

You'll get hurt , if theirs an option that removes the links from the tags and just add them as text -- go with it , it wont hurt you (AFAIK)...
 
I use this:

PHP:
<?php
/*
Plugin Name: Autosave Title As Tags
Plugin URI: http://fusedthought.com/downloads/autosave-post-title-as-tags-wordpress-plugin/
Description: Automatically use the words in your post title as a Tag.
Author: Gerald Yeo
Author URI: http://fusedthought.com
Version: 0.3
*/

function SaveTitleAsTag($post_ID) {
        $gpt = get_post($post_ID); 
        $posttitle = $gpt->post_title;
        $posttitle = strtolower($posttitle);
        if(get_the_tags($post_ID)){
                foreach(get_the_tags($post_ID) as $tag) {
                        $tag_name = $tag->name;
                        $tag_name  = strtolower($tag_name);
                        $posttitle = str_replace($tag_name, "", $posttitle);
                } 
        }
        $splittotags = explode(",", $posttitle);
        $lastarray = end($splittotags);
        foreach ($splittotags as $atag){
                if ($atag == $lastarray){
                        $atag = explode(" ", $atag);
                        foreach ($atag as $satag){
                                $satag = str_replace(" ", "", $satag);
                                if($satag !=NULL){
                                        wp_set_object_terms($post_ID, $satag, 'post_tag', true );
                                }
                        }
                }else{
                        if($atag !=NULL){
                                wp_set_object_terms($post_ID, $atag, 'post_tag', true );
                        }        
                }
        }
        //update_post_meta($post_ID, 'getthetag', $gettags);
}

add_action('save_post', 'SaveTitleAsTag');
?>

It auto generates tags from the title, there is a newer version of this out there, but it always saves the whole title as one tag which kinda sucks, look it up if you can fix it.
 
Status
Not open for further replies.

About the author

I
Active Member · Joined
1,666
Messages
157
Reactions
63
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom