[wp-hackers] 'option_update_plugins' filter won't run

Ryan Boren ryan at boren.nu
Tue Feb 10 06:32:52 GMT 2009


On Mon, Feb 9, 2009 at 9:56 PM, Stephen Rider <wp-hackers at striderweb.com> wrote:
> I'm working on a third-party plugin version checker.
>
> I'm trying to add a filter to the 'update_plugins' setting when it is called
> by get_option().  (simplified code follows)
>
> function add_filters() {
>        error_log( 'running add_filters()' );
>        add_filter( 'option_update_plugins', 'filter_update_plugins' );
> }
>
> In my PHP logs, I see that add_filters is called, and then
> get_option('update_plugins') is called multiple times, but
> filter_update_plugins() never runs.  It should be running in the course of
> every run of get_option('update_plugins')
>
> I've done similar filters, including one on
> 'pre_update_option_update_plugins', and that runs just fine.
>
> Logs give me:
>
> running add_filters()
> get_option('update_plugins')
> get_option('update_plugins')
> get_option('update_plugins')
> get_option('update_plugins')
>
> Any idea why this doesn't work?  I'm running WP 2.8 bleeding.

Are you using an add-on object cache backend like memcached, APC, or
xcache?  If so, update_plugins is not stored as an option but is
instead stored in the cache.  We're experimenting with having
transient data such as update_plugins stored in the cache whenever a
persistent object cache backend is installed so that we can avoid
cluttering up the options table.  See
http://trac.wordpress.org/ticket/9048

Transients have transient_* filters that behave the same as option_*.
Hook your function to both option_update_plugins and
transient_update_plugins.  option_update_plugins will be run for 2.7
and earlier.  transient_update_plugins will be run for 2.8.


More information about the wp-hackers mailing list