Advertisement
Guest User

Wordpress Update Post Function

a guest
Nov 15th, 2011
446
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data Copied
Advertisement