Make WordPress Core

Changeset 53151


Ignore:
Timestamp:
04/12/2022 06:05:45 AM (3 years ago)
Author:
peterwilsoncc
Message:

Options: Show error when updating all options exceeds max_input_vars.

On sites with a large number of options, the number of inputs when saving all options via the /wp-admin/options.php page may exceed PHP's max_input_vars setting, this will prevent saving.

An error is now shown if this is the case.

Props ishitaka, jorbin, maguijo, pento, sergeybiryukov.
Fixes #45438.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/options.php

    r52431 r53151  
    256256            wp_die( __( 'Sorry, you are not allowed to modify unregistered settings for this site.' ) );
    257257        }
    258         $options = explode( ',', wp_unslash( $_POST['page_options'] ) );
     258        $options = isset( $_POST['page_options'] ) ? explode( ',', wp_unslash( $_POST['page_options'] ) ) : null;
    259259    } else {
    260260        $options = $allowed_options[ $option_page ];
     
    333333            load_default_textdomain( $user_language_new );
    334334        }
     335    } else {
     336        add_settings_error( 'general', 'settings_updated', __( 'Settings save failed.' ), 'error' );
    335337    }
    336338
Note: See TracChangeset for help on using the changeset viewer.