G-Loaded Forums » WordPress Support

Add-Meta-Tags doesn't work with Wordpress 2.3

  • Started 2 years ago by hubschraubermuetze
  • Total 19 posts
  • Latest reply from dotups

  1. Hey guys,

    Wordpress 2.3 brings up a new architecture that kills the "categories" call of your plug-in. The following error occurs:

    WordPress database error: [Table 'usr_web463_1.wphm_categories' doesn't exist]
    SELECT cat_name FROM wphm_categories ORDER BY cat_name ASC

    It would be great if you could find a solution.

    Yours,

    Chris

    Posted 2 years ago #
  2. graywolf
    Member

    any word on a workaround or when the plugin will be updated?

    Posted 2 years ago #
  3. Rick
    Member

    Just change this

    function amt_get_all_categories($no_uncategorized = TRUE) {
    	/*
    	Returns a comma-delimited list of all the blog's categories.
    	The built-in category "Uncategorized" is excluded.
    	*/
    	global $wpdb;
    	$cat_field = "cat_name";
    	$sql = "SELECT $cat_field FROM $wpdb->categories ORDER BY $cat_field ASC";
    	$categories = $wpdb->get_results($sql);
    	$all_cats = "";
    	foreach ($categories as $cat) {
    	    if ($no_uncategorized && $cat->$cat_field != "Uncategorized") {
    		$all_cats .= $cat->$cat_field . ", ";
    	    }
    	}
    	$all_cats = strtolower(rtrim($all_cats, " ,"));
    	return $all_cats;
    }

    to

    function amt_get_all_categories($no_uncategorized = TRUE) {
    	/*
    	Returns a comma-delimited list of all the blog's categories.
    	The built-in category "Uncategorized" is excluded.
    	*/
    	global $wpdb;
    	$cat_field = "name";
    	$sql = "SELECT $cat_field FROM $wpdb->terms  ORDER BY $cat_field ASC";
    	$categories = $wpdb->get_results($sql);
    	$all_cats = "";
    	foreach ($categories as $cat) {
    	    if ($no_uncategorized && $cat->$cat_field != "Uncategorized") {
    		$all_cats .= $cat->$cat_field . ", ";
    	    }
    	}
    	$all_cats = strtolower(rtrim($all_cats, " ,"));
    	return $all_cats;
    }
    Posted 2 years ago #
  4. gnot
    Administrator

    QUICK'N'DIRTY FIX FOR WORDPRESS 2.3 USERS UNTIL THE NEW VERSION IS ROLLED OUT.

    WordPress 2.3 users must change the following in the amt_get_all_categories function:

    $cat_field = "cat_name";

    with:

    $cat_field = "name";

    Also substitute the following:

    $wpdb->categories

    with:

    $wpdb->terms

    Big thanks to all and especially Rick for pointing out the problem and the fix and Barmala for the solid code contribution.

    A new version of the plugin is on the way. (Unfortunately I do not have much free time at this period of the year, so it might take a few days)

    Also, if you have any ideas, thoughts etc about how the inclusion of the newly added WordPress feature, tags, should be implemented into Add-Meta-Tags, please feel free to post them.

    Thanks

    Posted 2 years ago #
  5. Rick
    Member

    My pleasure ;)

    Maybe do, in the final plugin version, a version check with get_bloginfo('version'); to know the correct table would be the best option.

    Or make the plugin 2.3 compatible only ;)

    Posted 2 years ago #
  6. Jonno99
    Member

    I love this plugin, but I'm still having a problem with it on WP 2.3.

    I implemented the fix in the previous posts, but when I activate the plugin I get the following error:

    WordPress database error: [Unknown column 'cat_name' in 'field list']
    SELECT cat_name FROM wp_terms ORDER BY cat_name ASC

    Any ideas?

    Posted 2 years ago #
  7. Jonno99
    Member

    I should mention that the error is on a fresh install of WP 2.3, not an upgrade.

    Posted 2 years ago #
  8. barmala
    Member

    The conditional code should read:

    if (version_compare(get_bloginfo('version'), '2.3') < 0) {
                    $cat_field = "cat_name";
                    $sql = "SELECT $cat_field FROM $wpdb->categories ORDER BY $cat_field ASC";
            } else {
                    $cat_field = "name";
                    $sql = "SELECT $cat_field FROM $wpdb->terms ORDER BY $cat_field ASC";
            }
    Posted 2 years ago #
  9. gnot
    Administrator

    Barmala, thanks for the contribution. :)

    At this point I would like to outline the status of the new version.

    Changes in the upcoming 1.5 version:

    1. Fix for the bug the new taxonomy system has caused (complete)
    2. support for localization (complete)
    3. support for the new WP 2.3 feature: tags (in progress)
    4. function to convert keywords from custom fields to tags. (planned)

    Also, I should mention that this will be the last version that will be backwards compatible with very old WordPress versions (eg v1.5.2). Further development of the plugin will focus on the features and code changes of the latest WordPress versions only.

    The final 1.5 version will be delayed for a couple of weeks due to severe lack of free time. Until then, I seriously consider releasing a beta version with the changes that are complete.

    Thanks for your understanding.

    Posted 2 years ago #
  10. Anonymous

    Could somebody explain this to me in noob terms, I'm getting the same error on the homepage when I activate the plug-in. This is my first blog and don't understand php. I have wordpress 2.3, where do I find the amt_get_all_categories function?

    Thanks

    EDIT:

    I found it, I clicked on plug-in editor and clicked, "Add meta tags" plug-in, and those lines of code were in there and fixed the problem.

    Posted 2 years ago #
  11. gnot
    Administrator

    The new version 1.5 of Add-Meta-Tags has been released today.

    Also, read the relevant announcement with the changes that this version includes.

    Thanks for your interest and contributions.

    Posted 2 years ago #
  12. theblade24
    Member

    I am using new version 1.5 with wordpress 2.3.1 and when trying to activate plugin I get this error

    Plugin could not be activated because it triggered a fatal error.
    Parse error: parse error, unexpected T_VARIABLE, expecting T_STRING in /var/www/html/wordpress/wp-content/plugins/add-meta-tags.php on line 324

    I WAS using a modified version of 1.2 as a work around and it worked correctly. But now 1.5 is not working for me.

    Posted 2 years ago #
  13. BHopkins
    Member

    Same exact error as theblade24:

    Plugin could not be activated because it triggered a fatal error.
    Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING in /home/*/public_html/callcenterconsultant/wp-content/plugins/add-meta-tags.php on line 324

    Other plugins activated:
    404 Notifier
    Akismet
    FeedBurner Feedsmith
    Google XML Sitemaps
    Popularity Contest
    Share This
    WP Contact Form III

    Wordpress 2.3.1

    Posted 2 years ago #
  14. gnot
    Administrator

    Some remnants from the old 1.2 version have been left by mistake in the 1.5 version. This error does not affect those who use a custom list of keywords for the home page.

    A new bug fix version (1.5.1) will be released shortly.

    Thanks all for your feedback and I am sorry for the inconvenience.

    Posted 2 years ago #
  15. gnot
    Administrator

    @theblade24: Chances are that your workaround was not correct, especially if you had followed any instructions on this page. The problem was in the SQL query that retrieved all the blog categories. It was inadequate for WordPress of version 2.3 and above.

    Posted 2 years ago #
  16. gnot
    Administrator

    A bug-fix version, 1.6, has just been released addressing the issue with the fatal error.

    Changes in 1.6:

    • A line of code (n.324) had accidentally beed left over in the new code causing a fatal error when the plugin was used.
    • The query that retrieves the blog categories had not been tweaked enough to suit the needs of the new taxonomy system. It has been fixed, while backwards compatibility has been maintained.

    The 1.6 version has run smoothly on my blog. Please report any issues ASAP.

    Thanks in advance and sorry for the inconvenience.

    Posted 2 years ago #
  17. dotups
    Member

    I am using v1.6 with Wordpress 2.3 and really like it. Meta tag insertion features have worked great. However, I encounter problems whenever anything in WP is updated.

    When saving an edited post, rather than being returned to the post, I receive the following:

    Warning: Cannot modify header information - headers already sent by (output started at /home/prize/public_html/writer-com/wp-content/plugins/add-meta-tags-1.6/add-meta-tags.php:511) in /home/prize/public_html/writer-com/wp-includes/pluggable.php on line 391

    The same error message is generated when trying to use print or email to features.

    Whe trying to modify keywords via a custom field the following error message is generated:

    Warning: Cannot modify header information - headers already sent by (output started at /home/prize/public_html/writer-com/wp-content/plugins/add-meta-tags-1.6/add-meta-tags.php:511) in /home/prize/public_html/writer-com/wp-includes/classes.php on line 738 contest, %cats%, %tags%

    Ideas?

    Posted 2 years ago #
  18. gnot
    Administrator

    @dotups: Hi, the add-meta-tags source contains a total of 510 lines of code, so I assume that this is a modified version, for which I am afraid I am unable to offer any help. If this assumption is wrong and you use the 1.6 version as is, please provide some more details, as this is the first time that such an issue is reported.

    Posted 2 years ago #
  19. dotups
    Member

    @gnot: Hello, thank you very much for the reply. I deactivated and re-activated the plugin again. Alas, the problem is no more. Thanks again.

    Posted 2 years ago #

RSS feed for this topic

Reply

You must log in to post.