return $options; } /** * Sanitizes, then saves the options to the database. * * @since 4.0.0 * * @param array $options An array of options to sanitize, then save. * @return void */ public function sanitizeAndSave( $options ) { if ( ! is_array( $options ) ) { return; } // First, recursively replace the new options into the cached state. // It's important we use the helper method since we want to replace populated arrays with empty ones if needed (when a setting was cleared out). $cachedOptions = aioseo()->core->optionsCache->getOptions( $this->optionsName ); $dbOptions = aioseo()->helpers->arrayReplaceRecursive( $cachedOptions, $this->addValueToValuesArray( $cachedOptions, $options, [], true ) ); // Now, we must also intersect both arrays to delete any individual keys that were unset. // We must do this because, while arrayReplaceRecursive will update the values for keys or empty them out, // it will keys that aren't present in the replacement array unaffected in the target array. $dbOptions = aioseo()->helpers->arrayIntersectRecursive( $dbOptions, $this->addValueToValuesArray( $cachedOptions, $options, [], true ), 'value' ); // Update the cache state. aioseo()->core->optionsCache->setOptions( $this->optionsName, $dbOptions ); // Update localized options. update_option( $this->optionsName . '_localized', $this->localized ); // Finally, save the new values to the DB. $this->save( true ); } } WordPress › Error

There has been a critical error on this website.

Learn more about troubleshooting WordPress.