|
@@ 1535-1541 (lines=7) @@
|
| 1532 |
|
$success = true; |
| 1533 |
|
$errors = array(); |
| 1534 |
|
|
| 1535 |
|
if ( false !== $filename ) { |
| 1536 |
|
// According to https://codex.wordpress.org/Function_Reference/wp_insert_attachment we need this file. |
| 1537 |
|
require_once( ABSPATH . 'wp-admin/includes/image.php' ); |
| 1538 |
|
// Generate metadata for the attachment. |
| 1539 |
|
$attach_data = wp_generate_attachment_metadata( $attachment_id, $filename ); |
| 1540 |
|
wp_update_attachment_metadata( $attachment_id, $attach_data ); |
| 1541 |
|
} |
| 1542 |
|
|
| 1543 |
|
if ( 0 !== $parent ) { |
| 1544 |
|
set_post_thumbnail( $parent_post_id, $attachment_id ); |
|
@@ 1772-1777 (lines=6) @@
|
| 1769 |
|
$success = true; |
| 1770 |
|
$errors = array(); |
| 1771 |
|
|
| 1772 |
|
if ( false !== $filename ) { |
| 1773 |
|
// According to https://codex.wordpress.org/Function_Reference/wp_insert_attachment we need this file. |
| 1774 |
|
require_once( ABSPATH . 'wp-admin/includes/image.php' ); |
| 1775 |
|
// Generate metadata for the attachment. |
| 1776 |
|
$attach_data = wp_generate_attachment_metadata( $attachment_id, $filename ); |
| 1777 |
|
} |
| 1778 |
|
|
| 1779 |
|
// Put the data from salesforce into the meta array. |
| 1780 |
|
$attach_new_data = array(); |