Media Cleanup – Modify search regexps

The Broadcast Media Cleanup add-on provides actions to allow you to add or remove regexps that are used during the database search.

The snippet below shows how to add some regexps to the custom field ID search.

Specifically, it adds two matches:

  • :123}
  • “123”
add_action( 'broadcast_media_cleanup_find_unused_media', 'my_broadcast_media_cleanup_find_unused_media' );
function my_broadcast_media_cleanup_find_unused_media( $action )
{
  $action->custom_field_id_regexps[] = '/:MEDIAID}/';
  $action->custom_field_id_regexps[] = '/"MEDIAID"/';
 // You can also use ->options_id_regexps and ->post_content_id_regexps
}