How do you make an image the same as the original post without having to upload the image again? This is based on our site using one image media that crosses sites.
// Featured Image.
if ( $featured_image ) {
// Because of the various CDN plugins around we can't just
// use media_handle_upload. We have to actually retrieve the
// image then re-upload it.
$image = wp_remote_get( $featured_image->url );
if ( 200 === wp_remote_retrieve_response_code( $image ) ) {
// Upload the image to this site's upload dir.
$attachment = wp_upload_bits( basename( $featured_image->path ), null, $image['body'], date( "Y-m", strtotime( $image['headers']['last-modified'] ) ) );
$featured_image = $this->prepare_featured_image( $original_post );
if ( empty( $attachment['error'] ) ) {
// Get the filetype.
$filetype = wp_check_filetype( basename( $attachment['file'] ), null );
$filename = $attachment['file'];
// Setup the attachment data.
$attachment_data = array(
'post_mime_type' => $filetype['type'],
'post_title' => $featured_image->post_title,
'post_excerpt' => $featured_image->post_excerpt,
'post_content' => '',
'post_status' => 'inherit',
);
// Insert the new attachment data with our basic information.
$attachment_id = wp_insert_attachment( $attachment_data, $filename, $aggregated_post_id );
// Check the wp_generate_attachment_metadata() function exists.
if ( ! function_exists( 'wp_generate_attachment_metadata' ) ) {
require_once ( ABSPATH . 'wp-admin/includes/image.php' );
}
// Generate the raw iamge meta data.
$attachment_data = wp_generate_attachment_metadata( $attachment_id, $filename );
// Save the image meta data to the new attachment.
wp_update_attachment_metadata( $attachment_id, $attachment_data );
// Set as the feature image.
set_post_thumbnail( $aggregated_post_id, $attachment_id );
} else {
error_log( "MSCP: Error uploading attachment. post_id = {$aggregated_post_id}, blog_id = $blog_id", 0 );
}
}
}
]]>
Wondering if it’s possible to have all posts from sub-sties post to the main site without sub-blog owners having to check the post each time in the post editor?
]]>Is it possible to crosspost between different domains in one multi-site installation? For example:
https://www.domain1.com
https://www.domain2.com
https://www.domain3.com
Hey
When creating a post, some users dont see the crosspost field but the empty field is some few pixels wide. Also dont see the options other see. What could be wrong?
]]>Hi
Hello, I’m using this plugin on my network. The plugin was working fine, but suddenly it duplicated a specific post generating a hundred copies on the main site of the network. I started using delete duplicate posts, cleaned the database and uninstalled and reinstalled the plugin, but he keeps making copies of the post, can you help me with this?
My Website is vistolivre.com
thanks in advance for your time
]]>Hi, this is a very useful plugin. However, I noticed that the crossposting options appears with posts only. Does the plugin support pages too? And yes, supporting cpt would be a great option!
]]>Hello,
I used the CPT UI to create custom post types and I see that they have custom support slugs. Does this plugin support CPT?
Thanks!
]]>