Tags to Meta Tag Keywords in WordPress


Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /nfs/c02/h04/mnt/20222/domains/andywibbels.com/html/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524

I’m prepping my blogs for a WordPress 2.0 upgrade and was looking to see how best to add tags to the system. I decided on the Ultimate Tag Warrior plugin (you gotta love these plugin names – like an IT department would have come up with that – or the term webmaster…). I then figured out how to get the tags to pop out as keywords in a single post’s meta tags.
The Tag Warrior plugin allows you define different formats for the tags. You can display as a list, as links to Technorati or other configurations. I made a configuration for meta tag keywords. Just go to the ultimate-tag-warrior-core.php file and scroll to where all the $predefinedFormats are happening (around line 1142 in the version of the plugin I’m using).
Then pop in this code:
$predefinedFormats["metatagkeywords"] = array (
"pre"=>"<meta name=\"keywords\" content=\"", "default"=>"%tag%, ", "first"=>"%tag%, ", "last"=>"%tag%", "post"=>"\">", "none"=>"");

Save that and then go your template’s header.php file. Add in this bit:
<?php if ( is_single() ) { ?>
<?php UTW_ShowTagsForCurrentPost("metatagkeywords") ?>
<?php } ?>

That will pop the keywords only for a page displaying a single post.

2 thoughts on “Tags to Meta Tag Keywords in WordPress


  1. Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /nfs/c02/h04/mnt/20222/domains/andywibbels.com/html/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524
    Ma2T

    Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /nfs/c02/h04/mnt/20222/domains/andywibbels.com/html/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524

    Thanks for the code, modified it a little to get it to work in my situation.
    Cheers 🙂

    Reply

  2. Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /nfs/c02/h04/mnt/20222/domains/andywibbels.com/html/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524
    16fc1df566ef

    Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /nfs/c02/h04/mnt/20222/domains/andywibbels.com/html/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524

    16fc1df566ef…

    16fc1df566ef56c4a904…

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *