Advertisement
Guest User

Untitled

a guest
Nov 9th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.42 KB | None | 0 0
  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>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement