[wp-trac] [WordPress Trac] #39286: Standardizing actions and filters for adding, getting, setting, updating, and deleting options and transients
WordPress Trac
noreply at wordpress.org
Thu Jul 21 14:33:56 UTC 2022
#39286: Standardizing actions and filters for adding, getting, setting, updating,
and deleting options and transients
--------------------------------+------------------------------
Reporter: NathanAtmoz | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Options, Meta APIs | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------------+------------------------------
Comment (by johnjamesjacoby):
Consistent patterns make for happy developers, and I am in agreement with
you here @NathanAtmoz. These functions and their hooks are an opportunity
for improvement that I have personally experienced myself multiple-
multiple times. I always end up digging into the code to make sure I'm
using the right hooks in the right ways.
I do not feel strongly about the `pre_`, `post_`, or `present/past` tenses
for hook naming. `before` & `after` are also sometimes used (and probably
are my preference these days) because they remove ambiguity with "post"
which is used all over the place for other things. (I know you didn't
suggest `post_` here, but it goes along with `pre_` so I'm just mentioning
it for the sake of...)
The other thing that crosses my mind (once we start wanting to create a
pattern for calling multiple hooks in a consistent way) is if this may
also be an opportunity to redefine the problem and determine if a new API
makes sense to encapsulate the routine code being written, or at least
solidly eliminate that possibility. Let's not use the actions & filters
APIs ''only'' because they already exist, and make sure they are the
correct or best approach. And/or, is it DRY'able, etc...
Thanks @NathanAtmoz for this first ticket of yours. I know it's a few
years old now, but it is on my mind!
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39286#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list