- Natural Search Blog - https://www.naturalsearchblog.com -

Tagging WordPress Pages with Ultimate Tag Warrior

I’ve blogged before about the SEO benefits of tagging blog posts [1]. For those bloggers using WordPress, I recommend the Ultimate Tag Warrior plugin to accomplish this.

But what if you have a WordPress-powered site and you want to tag static Pages, not just Posts? Well I have some good news! Even though Ultimate Tag Warrior doesn’t currently support tagging of Pages, I managed to figure out a workaround. The hack (to version 3.14159 of the plugin) involves the addition of a mere two lines of code…


First, add after line 1551 of ultimate-tag-warrior-core.php:
$request = preg_replace("/ AND post_status != 'static'/","", $request);

Second, and add after line 819 on ultimate-tag-warrior-actions.php:
add_action('edit_page_form', array('UltimateTagWarriorActions','ultimate_display_tag_widget'));

The first line modifies the MySQL select statement that specifically excludes static pages.

The second line adds the tag field to the Write Page form.

I’ve communicated this hack to Christine Davis, the author of the UltimateTagWarrior plugin. Happily, she said she will look at adding it to the next version. 🙂

UPDATE: This hack has made it into the latest version of UTW. Unfortunately, the hack doesn’t work with WordPress 2.1. So if you’re running WP2.1, tagged static pages don’t show up on tag pages. That’s because the WordPress developers switched to using post_type = ‘page’ for static pages. So I got it working by putting the following into line 1564 in ultimate-tag-warrior-core.php (version 3.1415926 of UTW):
$request = preg_replace("/post_type = 'post'/","post_type = 'post' OR post_type = 'page'", $request);