[wp-trac] [WordPress Trac] #40047: Add term_meta to WP_Term class getter method
WordPress Trac
noreply at wordpress.org
Sun Mar 12 20:06:21 UTC 2017
#40047: Add term_meta to WP_Term class getter method
-----------------------------------+------------------------------
Reporter: barryceelen | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch 2nd-opinion | Focuses:
-----------------------------------+------------------------------
Comment (by flixos90):
@boonebgorges I think we need to discuss this in a broader scope as you
mentioned comments do not support this either. I personally lean towards
introducing this functionality, but I do not have a strong opinion for one
side or the other here.
One should always be aware that any class property will take precedence.
So I don't think the BC concerns are very critical here, especially since
core rarely introduces new properties (since we never change the database
schema).
In my own projects I often use wrapper classes for WordPress objects that
make interaction with them easier, and if a type supports meta, I include
this functionality as I consider it valuable. So it would not benefit me
personally, but I think it's useful to anyone who uses the
`WP_Post`/`WP_User`/`WP_Comment`/`WP_Term` objects as is.
On the other hand, multisite's `WP_Site` and `WP_Network` could have
something like this too, for site and network options respectively (due to
recent discussions between what conceptually differs between options and
metadata). If these options became available in the same way as we're
discussing meta, changes would be high that people would unexpectedly do
many unnecessary `switch_to_blog()` calls. So the possibly high complexity
/ cost of retrieving such a value gets kind of obscured when one can
assume these values are like class properties. Not a strong argument
against it, but something to consider.
Maybe introducing a method `get_meta()` on all of these classes would be a
better solution, for explicit and clear access, and they would still make
it a bit easier to retrieve metadata compared to calling `get_*_meta()`
with the object's ID.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40047#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list