- Credits
- Requirements
- What does it do?
- How does it work?
- How to install the Plugin?
- Tagging of Pages?
- Version History
- Found a bug? Feature request?
- License
This is a tiny plugin I wrote to use the new native tagging from WordPress 2.3 to automatically create a meta-keyword-tag for articles and pages on my blog. It creates the meta-keyword-tag for other pages of the blog as well.
The current version 0.6.4 is available for download at the WordPress plugin directory.
The plugin’s sourcecode is available via subversion repository
There is a support-forum for this plugin.
Credits
The following people helped me a lot and participated in solving some bugs (without special order):
Thank you very much!!!
Requirements
The only thing you need, is a running installation of WordPress 2.7 or later.
What does it do?
The plugin adds a meta-tag to the html-header-part of your blog. This meta-tag contains keywords that describe the contents of the html-page. Adding this kind of meta-tag is one part of the job of optimizing your blog for search engines. To learn more about search engine optimization, I recommend reading and understanding these articles:
With WordPress 2.3 a new native tagging-feature was introduced. I needed a plugin that would allow me to use the new tagging for the meta-keywords as well. Unfortunately, I couldn’t find one, so I wrote one myself.
How does it work?
For articles and pages, it takes the tags and puts them into the meta-tag. Normally, you do not need to modify your theme to make this happen. The plugin uses one of the WordPress hooks to add the tag to your blog. The only thing you have to make sure is that your blog’s header-template (e.g. header.php) contains this tempate-tag:
<?php wp_head(); ?>
The plugin adds the following keywords:
- For single articles and pages it uses the native WordPress 2.3 tags given to the article by the author
- When pages or articles are untagged, the default keywords are applied
- For category- and tag-pages, the category- or tag-title is used as the single keyword
- For archive-pages, the word “archive” and the name/number of the current day, month or year is used
- For author pages, the word “author” and the nickname of the author is used.
- For all other pages, the default-keyword are used. You can set you own default keyword on the options-page of the plugin.
How to install the Plugin?
Just download the zip-archive, extract the plugin-file and upload it to /wp-contents/plugins.
Then go to the plugin-admin-section of your blog and press activate. Now go to the options section and click on ‘WPtags 4 MetaKeywords’. There, you can enter some default-keywords, that are used on pages, where the plugin cannot determine automatically, which keywords to choose.
Tagging of Pages?
WordPress 2.3 normally does not allow you to add tags to pages. But you can install a plugin to solve this problem. I recommend the Simple Tags plugin for WordPress 2.3. Among other benefits (like a highly customizable tag cloud or a ‘related posts’-feature) it enables you to tag pages. Simple Tags does not add a new tagging-system to WordPress, but builds upon the native WP-tagging.
Version History
- Version 0.6.4 — Minor changes for compatibility with WordPress 2.7: Uninstall-hook and internal registering of option-settings
- Version 0.6.3 — Minor changes for compatibility with WordPress 2.5.1
- Version 0.6.2 — Added some features to the plugin’s administration-page to enhance security. Changes were inspired by this great article from David Kierznowski.
- Version 0.6 — Fixed a bug that raised a “Page not found error” when pages or articels were untagged.
- Version 0.5 — Initial version
Found a bug? Feature request?
This plugin is hosted at WordPress.org, which is the right place for these matters. Of course, you can also send me an e-mail.
If you want to report a bug or submit a feature request, I would be delighted to hear from you! Please use this form to get in touch with me. Fill out the form and remember to select my plugin at the Component-section (choose “wptags-4-metakeywords”):
License
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
What a great idea, wish I’d thought of it first. I wasn’t sure how I was going to use the tagging feature now I know!
Hi, it seems when this plugin is enabled, my “pages” all come up as not found. Posts (including Categories, Archives, Tags lists) are fine, it is only pages that are having problem. Changing my permalink format (including just using the WordPress default) doesn’t seem to make any difference. Any idea what might be wrong?
@ David: I’m glad you like it! And if you face any problems with the plugin or have suggestions for improvements, please post a comment 🙂
@ Zit Seng: This sounds strange. I never faced this problem during testing… Maybe it’s an incompatibility-issue with another plugin? Perhabs you could send me a list of the plugins you use (info AT weinschenker DOT name)? If you could also send me the header.php of your theme it might help to solve the problem. After you have activated the plugin, does its option-page occur in the options-section of your dashboard?
Hi, I tried to email but it bounced with: Recipient address rejected: User unknown in virtual alias table
Here are the plugins I have:
Askimet
bbPress Integration
Demoracy
Flexi Pages Widget
Hello Dolly
KB Countdown Widget
Peter’s Custom Anti-Spam
Photopress
Sideblog WordPress Plugin
Watermark for Photopress
WPG2
WP
Yes the WPtags 4 MetaKeywords options page does appear.
I imagine dumping out header.php here might not work so nicely. Instead, I’ve put it at: http://zitseng.com/header_php
I’m running WP2.3, though I don’t think it matter since I note your site is also on WP2.3 🙂
Thanks for helping… 🙂
Hi!
I’m having the same problem as Zit Seng. All pages and untagged posts come up as not found when the plugin is enabled. The problem exists even with all other plugins disabled. Giving an untagged post a tag, allows me to open the link to that post. But since WordPress won’t let me tag pages, I was kind of stuck here.
My solution was to switch to the Simple Tags plugin. I realized that it also adds the tags as keywords in the page source, even with wptags disabled, so for now I think I’ll let it stay disabled.
Being a noob in coding, I learned a few things while trying to figure things out. I appreciate that, and all the work you have put into the free code.
Thanks a lot & Have a nice day!
Hey! Thanks for this great plugin! Like the other two commenters, I was having trouble with pages and untagged posts not appearing. My solution was to adjust this code in the metahead_keywords() function:
while (have_posts()) : the_post();
$sep = ‘,’;
$keywords = get_the_tags();
if (empty( $keywords ))
return false;
$keywords_list = ”;
foreach ( $keywords as $keyword ) {
$keywords_list[] = $keyword->name;
}
$keywords_list = join( $sep, $keywords_list );
?><meta name=”keywords” content=”” />name;
}
$keywords_list = join( $sep, $keywords_list );
?><meta name=”keywords” content=”” /><?php
}
endwhile;
That takes out the “return false,” which appears to have been causing the problem, while still only echoing the keywords if there are tags present. My problem is now gone. Hope this helps!
That last comment didn’t work, so I’ve uploaded the changed file to my blog:
http://natelaclaire.com/metaheader-keywords.zip
Hope that helps!
Thank you all very much for taking part in solving this issue. Your help is always welcome and appreciated!
I made some changes to the plugin inspired by your solutions. Further above on this page, I added your names in my new “Credits”-section.
Untagged pages and articles are now provided with the default-keywords. I have tested it with untagged articles and pages and I think it should work.
hi,
thanks for the great plugin, however it display error when I tried it. I don’t have tag yet in my blog
thanks
Fatal error: Call to undefined function: get_the_tags() in /home/themojo/public_html/wp-content/plugins/ metaheader-keywords.php on line 112
@mojo: this sounds like you are using a wordpress-version prior to 2.3 (function get_the_tags() was introduced with 2.3 and didn’t in the older versions).
You should upgrade to 2.3.1 before you run my plugin.
thanks jan,
actually I’m using WordPress Multi User. I think it’s not compatible. There are some WP plugins not working under WPMU.
Is there any way I could work around this problem ? maybe a little bit change in the code line2 ?
Which Version of WPMU are you using?
Native tagging is available for WPMU since version 1.3. I still think that the problem is that your wp-software does not support native tagging.
Thanks Jan,
Mine is WPMU 1.2.5, I need to upgrade it and hope it’ll work.
@mojo: Did you make a successful update? Does the plugin work now?
thx for your plugin! pretty cool!
Hello manele!
I’m glad you like it 🙂
wow pretty nice plugin . 10q
hi. thanks for plungin… but not work wordpress 2.5.1 …
keywords update error : “Are you sure you want to do this?”
yes, I see. I will post a bugfix as soon as possible.
The fixed Version 0.6.3 will be available in a few moments. Check the download-link above on the page.
The fixed version is now online for a few days. Any problems with the fix?
hi. Thanks for plugin
perfect.
Regards
Thaks for the plugin. Im consider to change my meta tag plugin now, thanks once again
bye
Hi Jan
I have noticed that the links to this page from both the WordPress.org Plugin Directory and within your plugin itself are broken.
The WP site and your plugin files are missing the “/plugins/” part of your URL for this page.
I suspect this may be adversely affecting the number of people using your excellent plugin!
Cheers,
Greg