Skip to content

Commit

Permalink
Change the updated-settings notice query var so WP does not auto-add …
Browse files Browse the repository at this point in the history
…settings notices
  • Loading branch information
jtsternberg committed Aug 22, 2017
1 parent 63f09c0 commit 2fd45e3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions includes/CMB2_Options_Hookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ public function options_page_menu_hooks() {
add_action( "admin_print_styles-{$page_hook}", array( 'CMB2_hookup', 'enqueue_cmb_css' ) );
}

if ( ! empty( $_GET['updated'] ) ) {
if ( 'true' === $_GET['updated'] ) {
if ( ! empty( $_GET['settings-updated'] ) ) {
if ( 'true' === $_GET['settings-updated'] ) {
add_settings_error( "{$this->option_key}-notices", '', __( 'Settings updated.', 'cmb2' ), 'updated' );
} else {
add_settings_error( "{$this->option_key}-notices", '', __( 'Nothing to update.', 'cmb2' ), 'notice-warning' );
Expand Down Expand Up @@ -174,7 +174,7 @@ public function save_options() {
->save_fields( $this->option_key, $this->cmb->object_type(), $_POST )
->was_updated(); // Will be false if no values were changed/updated.

$url = add_query_arg( 'updated', $updated ? 'true' : 'false', $url );
$url = add_query_arg( 'settings-updated', $updated ? 'true' : 'false', $url );
}

wp_safe_redirect( esc_url_raw( $url ), WP_Http::SEE_OTHER );
Expand Down

0 comments on commit 2fd45e3

Please sign in to comment.