diff --git a/includes/admin/functions.php b/includes/admin/functions.php index 65727cf6e2a..7abfcbb3c8a 100644 --- a/includes/admin/functions.php +++ b/includes/admin/functions.php @@ -87,7 +87,7 @@ function amp_add_custom_analytics( ) { $fields = get_analytics_component_fields($option); $analytics[$fields['id']] = $fields; } - + return $analytics; } add_filter( 'amp_post_template_analytics', 'amp_add_custom_analytics' ); diff --git a/includes/options/views/class-amp-analytics-options-serializer.php b/includes/options/views/class-amp-analytics-options-serializer.php index aa65740d9df..6838bb4f822 100644 --- a/includes/options/views/class-amp-analytics-options-serializer.php +++ b/includes/options/views/class-amp-analytics-options-serializer.php @@ -5,7 +5,7 @@ class Analytics_Options_Serializer { public function init() { add_action( 'admin_post_analytics_options', array( $this, 'save' ) ); } - + public static function save() { $option_name = 'analytics'; @@ -22,18 +22,17 @@ public static function save() { stripslashes($_POST['config']) ); - $inner_option_name = $_POST['vendor-type'] . '-' . $_POST['id']; - $analytics_options = get_option($option_name); if ( ! $analytics_options ) { $analytics_options = array(); - } + $inner_option_name = $_POST['vendor-type'] . '-' . $_POST['id'];} if ( isset($_POST['delete']) ) { unset($analytics_options[$inner_option_name]); } else { $analytics_options[$inner_option_name] = $new_analytics_options; } + update_option( $option_name, $analytics_options, false); // [Redirect] Keep the user in the analytics options page diff --git a/includes/options/views/class-amp-analytics-options-submenu-page.php b/includes/options/views/class-amp-analytics-options-submenu-page.php index 00865f23287..9a382d801eb 100644 --- a/includes/options/views/class-amp-analytics-options-submenu-page.php +++ b/includes/options/views/class-amp-analytics-options-submenu-page.php @@ -16,7 +16,7 @@ private function render_option($id = "", $type = "", $config = "") { ?>