WordPress.org

Ready to get started?Download WordPress

Forums

Add Meta Tags
[resolved] Cannot disable "Automatic Basic Metadata" (5 posts)

  1. anve
    Member
    Posted 1 year ago #

    I go to Options -> Metadata. I want to disable Automatic Basic Metadata:

    Automatically generate the description meta tag for single posts, pages, category-based archives and tag-based archives. If this is unchecked, you can still set a description meta tag by using the description custom field.

    Automatically generate the keywords meta tag for single posts, category-based archives and tag-based archives. Automatic keywords are not supported on pages. If this is unchecked, you can still set a keywords meta tag by using the keywords custom field.

    If I uncheck these two fields and click "Save Changes" the fields are checked again. I cannot change this setting. How can I disable this?

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

  2. anve
    Member
    Posted 1 year ago #

    Thanks to this post I found a temporary solution. In add-meta-tags.php (wp-content/plugins/add-meta-tags) I added:

    elseif ( $def_key == 'auto_description' || $def_key == 'auto_keywords' ) {
    				if( !isset($_POST[$def_key]) ){
    					$add_meta_tags_opts[$def_key] = 0;
    				}
    			}

    So starting at line 177 it looks like the following:

    if (isset($_POST['info_update'])) {
    
            // Update settings
    
            $add_meta_tags_opts = array();
    
            foreach ($default_options as $def_key => $def_value) {
    
                // **Always** use the <code></code>settings_version<code></code> from the defaults
                if ($def_key == 'settings_version') {
                    $add_meta_tags_opts['settings_version'] = $def_value;
                }
    
                // Add options from the POST request (saved by the user)
                elseif ( array_key_exists($def_key, $_POST) ) {
                    $add_meta_tags_opts[$def_key] = $_POST[$def_key];
                }
    			// here is my fix
    			elseif ( $def_key == 'auto_description' || $def_key == 'auto_keywords' ) {
    				if( !isset($_POST[$def_key]) ){
    					$add_meta_tags_opts[$def_key] = 0;
    				}
    			}
    
                // If missing (eg checkboxes), use the default value
                else {
                    $add_meta_tags_opts[$def_key] = $def_value;
                }
            }
    
            // Finally update the Add-Meta-Tags options.
            update_option("add_meta_tags_opts", $add_meta_tags_opts);
    
            //var_dump($_POST);
            //var_dump($add_meta_tags_opts);
    
            amt_show_info_msg(__('Add-Meta-Tags options saved', 'add-meta-tags'));
    
        }

    $default_options

    Array
    (
        [settings_version] => 2
        [site_description] =>
        [site_keywords] =>
        [global_keywords] =>
        [site_wide_meta] =>
        [auto_description] => 1
        [auto_keywords] => 1
        [auto_opengraph] => 0
        [auto_dublincore] => 0
        [noodp_description] => 0
        [noindex_search_results] => 1
        [noindex_date_archives] => 0
        [noindex_category_archives] => 0
        [noindex_tag_archives] => 0
        [noindex_author_archives] => 0
        [copyright_url] =>
        [default_image_url] =>
        [i_have_donated] => 0
    )
  3. aigarinsh
    Member
    Posted 1 year ago #

    Same problem here. According to this post http://wordpress.org/support/topic/settings-not-saving-3?replies=1 it has not been fixed.

  4. George Notaras
    Member
    Plugin Author

    Posted 1 year ago #

    This bug (see also here) will be fixed in the next release.

    Thanks for your feedback.

  5. George Notaras
    Member
    Plugin Author

    Posted 1 year ago #

    This bug affected all settings which were managed by a checkbox and whose default value was 'checked'. It has been fixed in 2.3.0.

    Thanks to all for your valuable feedback and to @anve for code contribution.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic