Advertisement
Guest User

Wordpress Update Post Function

a guest
Nov 15th, 2011
492
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.31 KB | None | 0 0
  1. function update_parent($parent_id, $post_id){
  2.     global $wpdb;
  3.    
  4.     $parent_id = (string)$parent_id;
  5.     $post_id = (string)$post_id;
  6.    
  7.     $result = $wpdb->update( $wpdb->posts, array( 'post_parent' => $parent_id ),array( 'ID' => $post_id ));
  8.    
  9.     if($result === FALSE){
  10.         return false;
  11.     }else{
  12.         return true;
  13.     }
  14. }
  15.  
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement