This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
plugin_auto_update_setting_html filter
Filters the HTML of the auto-updates setting for each plugin in the Plugins list table.
To use plugin_auto_update_setting_html filter, first you have to register it using add_filter. You can write this code into functions.php of your activated theme or in a custom WordPress Plugin.
We at WePlugins, always prefer to create a custom WordPress Plugin while using hooks so nothing breaks when you update your WordPress Theme in the future.
In the below live example, we have defined a function weplugins_modify_plugin_auto_update_setting_html_defaults which takes 3 parameters and we registered using add_filter. The first parameter plugin_auto_update_setting_html is the name of the hook, The second parameter weplugins_modify_plugin_auto_update_setting_html_defaults is the name of the function which needs to be called, the third parameter is the priority of calling the hook if the same hook is used multiple times and the last parameter is the number of arguments (if any) to be passed in the registered function.
Sometime, you have to remove a registered hook so you can use remove_filter to remove plugin_auto_update_setting_html filter.
Parameters
Below are the 3 parameters required to use this hook.
- $html: (string) The HTML of the plugin’s auto-update column content, including toggle auto-update action links and time to next update.
- $plugin_file: (string) Path to the plugin file relative to the plugins directory.
- $plugin_data: (array) An array of plugin data. See get_plugin_data() and the ‘plugin_row_meta’ filter for the list of possible values.
Live Example 1
Below is an example of how you can use this hook.
function weplugins_modify_plugin_auto_update_setting_html_defaults($html, $plugin_file, $plugin_data) { // Update the $html variable according to your website requirements and return this variable. You can modify the $html variable conditionally too if you want. return $html; } // add the filter add_filter( "plugin_auto_update_setting_html", "weplugins_modify_plugin_auto_update_setting_html_defaults", 10, 3 );
Live Example 2
To remove a hook callback, use the example below.
remove_filter( "plugin_auto_update_setting_html", "weplugins_modify_plugin_auto_update_setting_html_defaults", 10, 3 );
Please make sure to provide the same callback function name, priority, and number of arguments while removing the hook callback.
Live Example 3
Another example demonstrating the conditional modification of the $html variable based on specific plugin data.
function weplugins_modify_plugin_auto_update_setting_html_conditionally($html, $plugin_file, $plugin_data) { if ($plugin_file == 'specific-plugin/specific-plugin.php') { $html = '<div>Custom HTML for Specific Plugin</div>'; } return $html; } // add the filter add_filter( "plugin_auto_update_setting_html", "weplugins_modify_plugin_auto_update_setting_html_conditionally", 10, 3 );
Contact Us
If you need any customization or have trouble using this hook, feel free to contact us. We’d be happy to assist you.
Explore the latest in WordPress
Trying to stay on top of it all? Get the best tools, resources and inspiration sent to your inbox every Wednesday.