| Server IP : 198.54.115.198 / Your IP : 216.73.216.142 Web Server : LiteSpeed System : Linux server192.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64 User : seatpheu ( 1569) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/seatpheu/public_html/wp-content/plugins/media-cleaner/classes/parsers/ |
Upload File : |
<?php
// Attachment (https://wordpress.org/plugins/attachments/)
// Added by Mike Meinz
// Discussion: https://wordpress.org/support/topic/attachments-plugin/
add_action( 'wpmc_scan_postmeta', 'wpmc_scan_postmeta_attachments' );
function wpmc_scan_postmeta_attachments($id) {
global $wpmc;
$postmeta_images_ids = array();
$attachments_json = get_post_meta( $id, 'attachments', true ); // meta_key=='attachments'
$attachments_decoded = is_string( $attachments_json ) ? json_decode( $attachments_json ) : false;
if ( !empty( $attachments_decoded )) {
foreach ( $attachments_decoded as $AttachmentData => $TheAttachment ) {
foreach( $TheAttachment as $AttachmentData => $attachment ) {
array_push( $postmeta_images_ids, $attachment->id );
}
}
}
if ( !empty( $postmeta_images_ids ) ) {
$wpmc->add_reference_id( $postmeta_images_ids, 'ATTACHMENT (ID)' ); // mm change
}
}
?>