[wp-trac] [WordPress Trac] #31061: Accept FALSE as valid value from "pre_option_" hook

WordPress Trac noreply at wordpress.org
Tue Jan 20 23:50:13 UTC 2015


#31061: Accept FALSE as valid value from "pre_option_" hook
--------------------------------+------------------------------
 Reporter:  martin.krcho        |       Owner:
     Type:  enhancement         |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  Options, Meta APIs  |     Version:  4.1
 Severity:  normal              |  Resolution:
 Keywords:                      |     Focuses:  performance
--------------------------------+------------------------------

Comment (by ashfame):

 @martin I remember running into this problem an year ago. Using a
 persistent object caching backend like memcache solves this right away or
 even W3TC's file based object caching for that matter. But you are right,
 we should be able to set `false` as the default and I can only imagine
 this causing an issue for someone who is actually setting the default as
 NULL by filter to avoid the DB query.

 Another thought, will it make sense to save non-existent queries in a
 single DB option to save extra DB queries just like how we autoload
 options?

 Till someone else chimes in, I would mention that we wrote a plugin that
 did the job for us, before we starting using memcache, by saving the
 options which don't exist yet. When they do get saved, we filter them out
 from logic. It looked like it was working fine but never tested it for
 long to see any possible issues that might come out of it. You can check
 it out if you are interested -
 https://gist.github.com/ashfame/04f6243f0af27e3aee76 (I suggest you
 consider it as a starting point more than anything)

 Also, if you are feeling a bit experimental, you can try dropping a custom
 `object-cache.php` in `wp-content` directory which selectively save &
 retrieve `notoptions`  in a single option and rest acts non-persistently.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31061#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list