Opened 3 years ago
Last modified 3 years ago
#52963 new feature request
Could use a Helper Function for Auto-Updates
Reported by: | circlecube | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.7 |
Component: | Upgrade/Install | Keywords: | has-patch has-unit-tests |
Focuses: | Cc: |
Description
Would be nice to have a helper function (for example does_plugin_auto_update
) to check if a plugin has auto-updates enabled. Currently the plugins are listed as an array in auto_update_plugins
in the options table. It's not too tricky to grab the array and check if a plugin is listed,
<?php // check core setting for auto updates on a plugin $auto_update_plugins = (array) get_site_option( 'auto_update_plugins', array() ); if ( in_array( 'hello-dolly', $auto_update_plugins, true ) ) { // do something }
but would be ideal to have a helper do this
<?php if ( does_plugin_auto_update( 'hello-dolly' ) ) { // do something }
much like the current is_plugin_active
etc.
Change History (3)
This ticket was mentioned in PR #1167 on WordPress/wordpress-develop by donmhico.
3 years ago
#2
- Keywords has-patch has-unit-tests added; needs-patch removed
This PR adds a new function does_plugin_auto_updates( $plugin )
which returns whether a plugin is toggled for auto updates.
A few things.
- The function does not check whether a plugin is activated or not since it's possible to enable or disable the auto updates regardless of a plugin activation state.
- The function is added in
src/wp-admin/includes/plugin.php
so that file should be included first,include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
, if the function is needed in the frontend.
Trac ticket: https://core.trac.wordpress.org/ticket/52963
Note: See
TracTickets for help on using
tickets.
Hi there!
Like your idea to introduce a new function to check plugin auto-update or not. We can also add a theme auto-update function.
Marked as Feature Request