The is_plugin_paused() WordPress PHP function determines whether a plugin is technically active but was paused while loading.
Usage
$is_paused = is_plugin_paused( $plugin );
Example:
$is_paused = is_plugin_paused( 'my-custom-plugin/my-custom-plugin.php' );
Parameters
$plugin (string)
– Required. Path to the plugin file relative to the plugins directory.
More information
See WordPress Developer Resources: is_plugin_paused()
Examples
Checking if a specific plugin is paused
$plugin_path = 'my-custom-plugin/my-custom-plugin.php'; if ( is_plugin_paused( $plugin_path ) ) { echo "The plugin is paused."; } else { echo "The plugin is not paused."; }
Displaying a message if any plugin is paused
$all_plugins = get_plugins(); foreach ( $all_plugins as $plugin_path => $plugin_data ) { if ( is_plugin_paused( $plugin_path ) ) { echo "The {$plugin_data['Name']} plugin is paused."; break; } }
Counting paused plugins
$all_plugins = get_plugins(); $paused_plugins = 0; foreach ( $all_plugins as $plugin_path => $plugin_data ) { if ( is_plugin_paused( $plugin_path ) ) { $paused_plugins++; } } echo "There are {$paused_plugins} paused plugins.";
Resuming a paused plugin
$plugin_path = 'my-custom-plugin/my-custom-plugin.php'; if ( is_plugin_paused( $plugin_path ) ) { resume_plugin( $plugin_path ); echo "The plugin has been resumed."; } else { echo "The plugin is not paused."; }
Conditionally using a plugin function
$plugin_path = 'my-custom-plugin/my-custom-plugin.php'; if ( ! is_plugin_paused( $plugin_path ) ) { my_custom_plugin_function(); } else { echo "The plugin is paused, so its function cannot be used."; }