Using WordPress ‘plugin_auto_update_debug_string’ PHP filter

The plugin_auto_update_debug_string WordPress PHP filter allows you to modify the text string of the auto-updates setting for each plugin in the Site Health debug data.

Usage

add_filter('plugin_auto_update_debug_string', 'your_custom_function', 10, 4);

function your_custom_function($auto_updates_string, $plugin_path, $plugin, $enabled) {
    // your custom code here

    return $auto_updates_string;
}

Parameters

  • $auto_updates_string (string) – The string output for the auto-updates column.
  • $plugin_path (string) – The path to the plugin file.
  • $plugin (array) – An array of plugin data.
  • $enabled (bool) – Whether auto-updates are enabled for this item.

More information

See WordPress Developer Resources: plugin_auto_update_debug_string

Examples

Modify the auto-updates text

In this example, we change the text displayed for auto-updates in the Site Health debug data.

add_filter('plugin_auto_update_debug_string', 'change_auto_update_text', 10, 4);

function change_auto_update_text($auto_updates_string, $plugin_path, $plugin, $enabled) {
    if ($enabled) {
        $auto_updates_string = 'Enabled (Custom Text)';
    } else {
        $auto_updates_string = 'Disabled (Custom Text)';
    }

    return $auto_updates_string;
}

Add a prefix to the auto-updates text

In this example, we add a custom prefix to the auto-updates text.

add_filter('plugin_auto_update_debug_string', 'add_prefix_to_auto_update_text', 10, 4);

function add_prefix_to_auto_update_text($auto_updates_string, $plugin_path, $plugin, $enabled) {
    $prefix = 'Auto-Update: ';

    return $prefix . $auto_updates_string;
}

Display the plugin path in the auto-updates text

In this example, we display the plugin path along with the auto-updates text.

add_filter('plugin_auto_update_debug_string', 'show_plugin_path', 10, 4);

function show_plugin_path($auto_updates_string, $plugin_path, $plugin, $enabled) {
    return $auto_updates_string . ' (' . $plugin_path . ')';
}

Show custom text based on specific plugin

In this example, we show custom auto-updates text for a specific plugin.

add_filter('plugin_auto_update_debug_string', 'custom_text_for_specific_plugin', 10, 4);

function custom_text_for_specific_plugin($auto_updates_string, $plugin_path, $plugin, $enabled) {
    if ($plugin_path == 'your-plugin/your-plugin.php') {
        $auto_updates_string = 'Custom Auto-Update Text';
    }

    return $auto_updates_string;
}

Display additional plugin data in the auto-updates text

In this example, we display additional plugin data (e.g., version) along with the auto-updates text.

add_filter('plugin_auto_update_debug_string', 'display_additional_plugin_data', 10, 4);

function display_additional_plugin_data($auto_updates_string, $plugin_path, $plugin, $enabled) {
    $version = isset($plugin['Version']) ? $plugin['Version'] : 'Unknown';
    return $auto_updates_string . ' (Version: ' . $version . ')';
}