<?php | |
/** | |
* Determines if the user has permission to save the information from the submenu | |
* page. | |
* | |
* @since 1.0.0 | |
* @access private | |
* | |
* @param string $action The name of the action specified on the submenu page | |
* @param string $nonce The nonce specified on the submenu page | |
* | |
* @return bool True if the user has permission to save; false, otherwise. | |
*/ | |
function acme_user_can_save( $action, $nonce ) { | |
$is_nonce_set = isset( $_POST[ $nonce ] ); | |
$is_valid_nonce = false; | |
if ( $is_nonce_set ) { | |
$is_valid_nonce = wp_verify_nonce( $_POST[ $nonce ], $action ); | |
} | |
return ( $is_nonce_set && $is_valid_nonce ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment