HEX
Server: Apache/2.4.65 (Debian)
System: Linux 88f31f35b0b8 6.1.0-38-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.147-1 (2025-08-02) x86_64
User: www-data (33)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/plugins/media-cleaner/classes/parsers/attachments.php
<?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
	}
}

?>