Last active
September 10, 2018 19:33
-
-
Save jazzsequence/160f34ee5c06d34f934a25f0630bacd8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Save the screen option setting. | |
* | |
* @param string $status The default value for the filter. Using anything other than false assumes you are handling saving the option. | |
* @param string $option The option name. | |
* @param array $value Whatever option you're setting. | |
*/ | |
function set_option( $status, $option, $value ) { | |
if ( isset( $_POST['wp_screen_options_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['wp_screen_options_nonce'] ) ), 'wp_screen_options_nonce' ) ) { | |
if ( 'wordpress_screen_options_demo_options' === $option ) { | |
$value = isset( $_POST['wordpress_screen_options_demo'] ) && is_array( $_POST['wordpress_screen_options_demo'] ) ? $_POST['wordpress_screen_options_demo'] : []; // WPCS: Sanitization ok. | |
} | |
} | |
return $value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment