SHARE
TWEET

Untitled

a guest Nov 9th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require_once( '../wp-admin/includes/image.php' );
  2. // Generate the metadata for the attachment, and update the database record.
  3. $attach_id = wp_insert_attachment( $idImagePostTable, $dirwpattached, $idPost );
  4. $attach_data = wp_generate_attachment_metadata( $attach_id, $dirwpattached );
  5. var_dump( wp_update_attachment_metadata( $attach_id, $attach_data ));
  6. echo "<br><pre>";print_r($attach_id.'-'.$attach_data);echo"</pre>";
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top