Refactor cwv3_meta_save logic
This commit is contained in:
@ -112,12 +112,8 @@ class CWV3Admin {
|
|||||||
$post_types = $this->get_cwv3_post_types();
|
$post_types = $this->get_cwv3_post_types();
|
||||||
// check isset before access (edit by @jgraup)
|
// check isset before access (edit by @jgraup)
|
||||||
if ( isset( $_POST['post_type'] ) && in_array( $_POST['post_type'], $post_types ) ) {
|
if ( isset( $_POST['post_type'] ) && in_array( $_POST['post_type'], $post_types ) ) {
|
||||||
if ( ! current_user_can( 'edit_page', $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) {
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
if ( ! isset( $_POST['cwv3_meta'] ) || ! wp_verify_nonce( $_POST['cwv3_meta'], plugin_basename( __FILE__ ) ) ) { return; }
|
if ( ! isset( $_POST['cwv3_meta'] ) || ! wp_verify_nonce( $_POST['cwv3_meta'], plugin_basename( __FILE__ ) ) ) { return; }
|
||||||
}
|
if ( ! current_user_can( 'edit_page', $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) { return; }
|
||||||
}
|
|
||||||
|
|
||||||
// check isset before access (edit by @jgraup)
|
// check isset before access (edit by @jgraup)
|
||||||
if ( isset( $_POST['cwv3_auth'] ) ) {
|
if ( isset( $_POST['cwv3_auth'] ) ) {
|
||||||
@ -126,6 +122,8 @@ class CWV3Admin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the meta box for CWv3
|
* Render the meta box for CWv3
|
||||||
* @since 3.6.3
|
* @since 3.6.3
|
||||||
|
Reference in New Issue
Block a user