High Availability Options and Metadata Usage Monitoring

Developer Knowledge Level

This content is intended for WordPress developers, and it may require coding knowledge of WordPress, PHP, and JavaScript. Code examples provided here may contain errors or needs some additional coding. Make sure to test the code before using it on a live website!

The best way to detect which Options and Metadata are actually used by plugins or themes, plugin has a powerful Usage Monitoring feature. But, the main limitation, is that plugin can’t monitor any options or metadata usage that happens before SweepPress plugin was initialized, and because of that it will miss many plugins loading before.

But, the main Monitor object can be used on its own before the plugin is fully initialized.

Enable via WP-Config

This is the simplest method to enable this feature, by adding the one constant into wp-config.php file. There are two versions of this, depending on what you want to enable.

Enable just Update Monitoring

Add this line to the wp-config.php to just enable Update Usage Monitoring.

define( 'SWEEPPRESS_METADATA_MONITOR', 'on' );

Enable Update and Reading Monitoring

Add this line to the wp-config.php to enable both Reading and Update Usage Monitoring.

define( 'SWEEPPRESS_METADATA_MONITOR', 'full' );

Enable with MU plugin

This is the best method, because it loads before any plugin or theme. You need to create new PHP file to place it into wp-content/mu-plugins. Let’s name the file early-sweeppress-monitor-load.php.

Put this code into this file:

<?php

require_once WP_PLUGIN_DIR . '/sweeppress/d4plib/core.php';
require_once WP_PLUGIN_DIR . '/sweeppress/core/autoload.php';

define( 'SWEEPPRESS_METADATA_MONITOR', 'full' );

Dev4PressPluginSweepPressMetaMonitor::instance();

In the line with define, you can replace full with on.

Rate this article
0
0
16

You are not allowed to rate this post.

Leave a Comment