示例#1
0
 function save_meta_box_options($post_id)
 {
     // Skip if the nonce check fails
     if (!isset($_POST["{$this->_var}-nonce"]) || !wp_verify_nonce($_POST["{$this->_var}-nonce"], $this->_var)) {
         return;
     }
     // Don't save or update on autosave
     if (defined('DOING_AUTOSAVE') && true === DOING_AUTOSAVE) {
         return;
     }
     // Only allow those with permissions to modify the type to save/update a layout
     if (!current_user_can('edit_post', $post_id)) {
         return;
     }
     // Save/update options
     $options = ITForm::parse_values($_POST, array('prefix' => $this->_var));
     unset($options['nonce']);
     if (method_exists($this, 'validate_meta_box_options')) {
         $options = $this->validate_meta_box_options($options, $post_id);
     }
     update_post_meta($post_id, '_it_options', $options);
 }