[wp-trac] [WordPress Trac] #38082: Allow negative (placeholder) IDs in calls to get_metadata
WordPress Trac
noreply at wordpress.org
Sun Sep 18 05:16:58 UTC 2016
#38082: Allow negative (placeholder) IDs in calls to get_metadata
------------------------------------+------------------
Reporter: westonruter | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 4.7
Component: Options, Meta APIs | Version:
Severity: normal | Resolution:
Keywords: dev-feedback has-patch | Focuses:
------------------------------------+------------------
Comment (by dd32):
> Nav menu items are created in the customizer with negative IDs to serve
as placeholders.
> Along with this change the get_metadata function can short-circuit for
such negative IDs after the get_{$meta_type}_metadata filters apply since
no such objects would exist in in the database which uses UNSIGNED INTEGER
for ID fields
Can I just say this feels like a massive hack that should never have been
done in the first place, and probably shouldn't be extended to other parts
of the codebase? I'd actually prefer anything that *does* allow something
like this to be removed, or in the event of a negative ID being passed,
`return false`ing immediately before filters.
If there was a need to inject "placeholder" items into the structures,
they shouldn't be calling/running `get_*($neg_id)` but instead being
supplied by some kind of a `pre_*` filter on the object getters..
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38082#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list