[wp-trac] [WordPress Trac] #43941: Add default value to register meta
WordPress Trac
noreply at wordpress.org
Tue May 19 12:07:56 UTC 2020
#43941: Add default value to register meta
-------------------------------------------------+-------------------------
Reporter: spacedmonkey | Owner:
| johnbillion
Type: enhancement | Status: reviewing
Priority: normal | Milestone: 5.5
Component: Options, Meta APIs | Version: 4.6
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests early | Focuses: rest-api
needs-dev-note |
-------------------------------------------------+-------------------------
Comment (by johnbillion):
I would like to discuss the `$unfiltered` parameter more, it's not a
pattern I like elsewhere in WordPress as it doesn't give an indication of
the real purpose of the parameter. Its usage in
[attachment:"43941.11.diff"] is misleading because it only disables
''some'' filters in `get_metadata()`.
As a developer, when might I want or need an unfiltered value? Why isn't
this parameter available in `get_post_meta()` and corresponding wrapper
functions? Should it be? Why are some filters still applied when this
parameter is set to true?
I would rather see a new function for returning the raw value of a meta
field without its default value being applied. This makes the intention
more explicit and is what's needed here.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43941#comment:56>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list