Skip to content

AutoTagger

Finally found a WordPress plugin which does auto-tagging of posts by looking for a list of tags in the post content. I modified it a bit to make it also search for occurrences of existing used tags in the new post. I find this more handy since I can then just manage the regular WP tag list as usual and any future posts will be tagged appropriately. Not sure if the plugin maintainer will include my changes, but the full modified plugin file can be found here if you care.

Update: I’ve updated the plugin again to use word boundary regex instead of stristr which is not only case-insensitive, but also matches strings inside other strings.

Update: Actually, case-insensitivity is probably a good thing. I now use the following to match:

preg_match('/\b'.$tag.'\b/i', $content)

Updated script