WordPress.org

Ready to get started?Download WordPress

Forums

Add Meta Tags
[resolved] Minor bug in v2.1.0 (4 posts)

  1. Dan Rossiter
    Member
    Posted 1 year ago #

    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;
            }
        }
    }

    http://wordpress.org/extend/plugins/add-meta-tags/

  2. George Notaras
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. George Notaras
    Member
    Plugin Author

    Posted 1 year ago #

    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:

    http://codex.wordpress.org/Creating_Tables_with_Plugins#Adding_an_Upgrade_Function

    Thanks again for your feedback.

    I am marking this thread as resolved.

  4. Dan Rossiter
    Member
    Posted 1 year ago #

    Awesome! Thanks for the quick fix!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic