SetMetaValues() public method

Save all custom field values meta values for the post, this function assumes that $_POST['rc_cwp_meta_keys'] contains the names of the fields, while $_POST[{FIELD_NAME}] contains the value of the field named {FIELD_NAME}
public SetMetaValues ( integer $postId ) : void
$postId integer
return void
Example #1
0
 function SaveCustomFields($postId)
 {
     if (!wp_verify_nonce($_REQUEST['rc-custom-write-panel-verify-key'], 'rc-custom-write-panel')) {
         return $postId;
     }
     if (!current_user_can('edit_post', $postId)) {
         return $postId;
     }
     RCCWP_Post::SetCustomWritePanel($postId);
     RCCWP_Post::PrepareFieldsValues($postId);
     RCCWP_Post::SetMetaValues($postId);
     return $postId;
 }
Example #2
0
 /**
  *  This function is called when  a post is saves
  */
 function SaveCustomFields($postId)
 {
     global $flag;
     if ($flag == 0) {
         //for this save_post action doesn't execute twice
         $flag = 1;
         //security
         if (!wp_verify_nonce($_REQUEST['rc-custom-write-panel-verify-key'], 'rc-custom-write-panel')) {
             return $postId;
         }
         //the user  can edit posts?
         if (!current_user_can('edit_post', $postId)) {
             return $postId;
         }
         RCCWP_Post::SetCustomWritePanel($postId);
         RCCWP_Post::PrepareFieldsValues($postId);
         RCCWP_Post::SetMetaValues($postId);
         return $postId;
     }
 }
Example #3
0
 /**
  *  This function is called when  a post is saves
  */
 public static function SaveCustomFields($postId)
 {
     global $flag;
     if ($flag == 0) {
         //with this  the save_post action don't will be execute twice
         $flag = 1;
         //security
         if (!wp_verify_nonce(@$_REQUEST['rc-custom-write-panel-verify-key'], 'rc-custom-write-panel')) {
             return $postId;
         }
         //the user  can edit posts?
         if (!(current_user_can('edit_posts', $postId) || current_user_can('edit_published_pages', $postId))) {
             return $postId;
         }
         RCCWP_Post::SetCustomWritePanel($postId);
         RCCWP_Post::PrepareFieldsValues($postId);
         RCCWP_Post::SetMetaValues($postId);
         return $postId;
     }
 }