Timeline for get_option() filtering and getting out of recursion
Current License: CC BY-SA 3.0
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 18, 2012 at 15:13 | vote | accept | Rarst | ||
May 8, 2011 at 0:11 | history | tweeted | twitter.com/#!/StackWordPress/status/67018763559632896 | ||
May 7, 2011 at 22:27 | comment | added | kaiser | @Rarst - Beeing picky is ok. It's code :) And yes, I understand what your problem is. I yesterday tried to modify the output of the gallery shortcode (only the mark up) and that means writing the whole function from scratch (or repeating anything but 5 lines), because the only filters are a) a bypass at the beginning and b) the result. I'm just glad that i could get around the nav menu item problem with a pretty simple solution gist.github.com/960910 :) | |
May 7, 2011 at 20:58 | comment | added | Rarst | @kaiser that would work, but caching fallback value in advance kinda ruins it for me :) sorry to be picky... I just thought up multiple ways that would probably work, but most turn simple operation into cryptic mess or require such prep work which I don't really want to herd... | |
May 7, 2011 at 20:35 | comment | added | kaiser | @Rarst - Meant you could fetch those first in some var (before filtering) and then reference it. | |
May 7, 2011 at 19:36 | comment | added | Rarst | @kaiser I don't think autoload affects retrieval process and filters, it merely pre-caches option. Option will still pass through filters, the only difference is that it will come from cache rather than database first time. | |
May 7, 2011 at 18:46 | answer | added | TheDeadMedic | timeline score: 10 | |
May 7, 2011 at 18:42 | comment | added | kaiser |
Aren't some options autoloaded? For the other cases i understand your problem and even after thinking about for an quarter hour, i have no idea how it's meant to be done in case you need another option. The @anu flag surely is an option, but i guess the pre_option_.$option filter is meant to completely override the db-query, so maybe the wp dev thought you will then just add multiple queries instead of the default one. Btw: I hope you don't mind - I slightly modified the Q. :)
|
|
S May 7, 2011 at 18:33 | history | suggested | kaiser | CC BY-SA 3.0 |
extended filter example
|
May 7, 2011 at 18:32 | review | Suggested edits | |||
S May 7, 2011 at 18:33 | |||||
May 7, 2011 at 16:06 | comment | added | anu | @rarst Setting a flag could work then - don't think that adds too much complexity, although you would need to add a test at the start of your filter function, and set and unset the flag. | |
May 7, 2011 at 16:02 | comment | added | Rarst | @anu simply put I am looking for a way to circumvent recursion here without losing simplicity. I like to tinker robust and reusable extensions to native stuff for specific purposes. | |
May 7, 2011 at 15:54 | comment | added | anu | You could use a static variable as a flag to control access to your filter function - or are you looking for a way to not trigger the filter at all? | |
May 7, 2011 at 15:28 | history | asked | Rarst | CC BY-SA 3.0 |