WP Add Meta Tags 0.6 patch

The add-meta-tags WordPress plugin broke my WordPress 2.1 alpha site in more ways than one.

Update: Version 0.7 is out with fixes.

Anyway, here’s a (quick and dirty) patch against 0.6 to fix things.

--- add-meta-tags.php.old       2007-01-10 13:14:40.000000000 +0100
+++ add-meta-tags.php   2007-01-11 04:03:26.466994857 +0100
@@ -148,6 +148,7 @@

 function amt_clean_desc($desc) {
        // This is a filter for the description metatag text
+       $desc = stripslashes($desc);
        $desc = strip_tags($desc);
        $desc = htmlspecialchars($desc);
        $desc = preg_replace('/(\n+)/', ' ', $desc);
@@ -218,10 +219,9 @@
                if ( empty($site_keywords) ) {
                        // If $site_keywords is empty, then all the blog's categories are added as keywords
                        $my_metatags .= "\n<meta name=\"keywords\" content=\"";
-                       $all_cats = strip_tags(list_cats(FALSE, '', 'name', 'asc', '', FALSE, FALSE, FALSE, TRUE, FALSE,
 TRUE, '', '', TRUE, '', '', ''));
-                       $all_cats_arr = explode("\n", $all_cats);
+                       $all_cats_arr = get_categories();
                        foreach ($all_cats_arr as $cat) {
-                               $my_metatags .= strtolower(trim($cat)) . ', ';
+                               $my_metatags .= strtolower(trim($cat->category_nicename)) . ', ';
                        }
                        $my_metatags = rtrim($my_metatags, " ,\n") . "\" />\n";
                } else {

If you don’t have patch available, here’s the changed file (rename to .php).

I’m not quite sure whether the stripslashes is good there of if the bug comes from the admin panel, but frankly, I don’t care. I have other things to do.

2 Replies to “WP Add Meta Tags 0.6 patch”

  1. This is a patch. You need to apply it with either unix patch or w32 patch.

    If you don’t have a patch tool or no shell access, I’ll also make the changed version available for download.

Comments are closed.