Support » Plugins and Hacks » [Resolved] Minor bug in v2.1.0

[Resolved] Minor bug in v2.1.0

  • On line 853 in add-meta-tags.php there is a reference to a potentially non-existent array key. The following is one option to fix the problem.

    if ( !empty($content_keywords) && (is_single() || is_page()) ) {
        $options = get_option("add_meta_tags_opts");
        //$global_keywords = $options["global_keywords"]; // here's the issue
        if (array_key_exists('global_keywords', $options) && !empty($options["global_keywords"])) {
            $global_keywords = $options["global_keywords"];
            if ( strpos($global_keywords, '%contentkw%') ) {
                // The user has used the placeholder <code></code>%contentkw%<code></code>. Replace it with the content keywords.
                $content_keywords = str_replace('%contentkw%', $content_keywords, $global_keywords);
            } else {
                // The placeholder <code></code>%contentkw%<code></code> has not been used. Append the content keywords to the global keywords.
                $content_keywords = $global_keywords . ', ' . $content_keywords;


Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author George Notaras


    Dan, thanks.

    This happens when upgrading from an older version without saving the plugin settings once, so the ‘global_keywords’ setting is missing.

    Definitely a bug.

    I had planned to use register_activation_hook to automatically upgrade the stored settings, but I had this “brilliant” idea to postpone it for a later release, despite the fact that 2.1.0 added new settings.

    I’ll try to implement the solution using register_activation_hook today to resolve such issues once and for all. If this is not possible, I’ll go ahead using the proposed solution above for now.

    Thanks again for your feedback. Much appreciated.

    Plugin Author George Notaras


    Version 2.1.1 is out with an internal settings upgrade function.

    register_activation_hook is no longer called on bulk updates, so I had to use the plugins_loaded hook:


    Thanks again for your feedback.

    I am marking this thread as resolved.

    Awesome! Thanks for the quick fix!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Minor bug in v2.1.0’ is closed to new replies.