Remember to always check your PHP Error Logs.

Common Questions

– js_composer: yes, it was used some time ago by Visual Editor, but not anymore
– wplr-tmp: yes, totally
– wpseo-redirects: if you are using redirections in Yoast SEO, you should not delete this
The plugin has been extremely optimized so now this depends mainly on your WordPress install and your server. With PHP, for each page load (and therefore for each asynchronous requests, in the case of my plugin), WordPress loads itself every time. All the plugins are also being loaded and might even run a task. Unfortunately, Media Cleaner cannot do anything about it. You can make it faster by checking out a few options, but the best is to enhance the system. I am trying to keep an article about accelerating WordPress here.
It would be way too dangerous. A bad update, the page builder disabled temporary or another mishap and the WordPress install will be basically destroyed. So it’s better not. Also, having this running in the background would slow down the site every time a visitor would load the page (which is really isn’t good), might also crashs. WordPress was not really made for running background tasks (it can only reacts on specific actions) so it’s better to avoid it with such a plugin as Media Cleaner.

That said, if you really want to run a scan in the background every once in a while, you can do it using WP-CLI, and manually create a task (cron tab) on your server. You can ask your developer or system administrator to do this.
There is now a setting for it. Have a look at the Media Cleaner settings :)

Access Control (Roles)

By default, only the administror has access to the Cleaner Dashboard, and any user with the manage_options role (typically, the administrator) has access to the settings.

You can override the access to the Dashboard by adding a filter on wpmc_allow_usage. The following snippet will allow editors to access it.

add_filter( 'wpmc_allow_usage', function( $allow ) {
  return current_user_can( 'editor' ) || $allow;
} );

If you are interested in overring who can access the settings, you can add a filter on wpmc_allow_setup, it works exactly the same way.

Handling Issues for Developers

If you would like to handle special cases and additional detections of file usage, here are a few code snippets that you could use or adapt to your specific needs. You can add those snippets directly using the Code Snippets plugin (or add them into your functions.php file directly).

Images in category’s descriptions

add_action( 'wpmc_scan_once', 'wpmc_scan_once_post_categories', 10, 0 );

function wpmc_scan_once_post_categories() {
	global $wpdb;
	global $wpmc;
	$descs = $wpdb->get_col( "SELECT description FROM {$wpdb->term_taxonomy} WHERE taxonomy = 'category'" );
	foreach ( $descs as $desc ) {
		$urls = $wpmc->get_urls_from_html( $desc );
		$wpmc->add_reference_url( $urls, 'CONTENT (URL)' );

Overriding the Cleaner’s decisions

There are some cases where you would like to avoid the scan of certain files (owned by the administrator), or maybe the contrary and decide that all the Media entry with a certain name should be deleted. Everything is possible through those two filters:

  • wpmc_check_media ($in_use, $media_id, $is_broken). When called, this filter will be sent first a boolean stating if it has detected as in use or not by the plugin, and this is the value you should return as well (and override it if you like). The second parameter is the Media ID, from which you can get all the information you would like, and the third states if the media has been found broken (the physical files are missing for instance).
  • wpmc_check_file ($in_use, $file). Same as above, but for a filesystem scan. So in this case, you only have the filename.