[wp-trac] [WordPress Trac] #56752: Add get_post_metadata filters by $meta_key
WordPress Trac
noreply at wordpress.org
Thu Oct 6 23:18:56 UTC 2022
#56752: Add get_post_metadata filters by $meta_key
--------------------------------+-----------------------------
Reporter: galbaras | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Options, Meta APIs | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------------+-----------------------------
`get_metadata_raw()` applies `get_{$meta_type}_metadata` filters, which
means that when trying to filter a single meta key, this function will be
executed for EVERY meta key and require a condition that checks for the
correct meta key to filter.
It would be a great idea to have `get_{$meta_key}_metadata` filters. Since
`$meta_key` is some generic string, though, it cannot be used directly,
and must be adapted first to suit a PHP function name by replacing any
non-alphanumeric character with an underscore.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56752>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list