WordPress.org

Make WordPress Core

Opened 22 months ago

Last modified 15 months ago

#24726 new enhancement

New filter hook for get_metadata()

Reported by: JD55 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Options, Meta APIs Keywords: has-patch
Focuses: Cc:

Description

The get_metadata() function has one filter hook: get_{$meta_type}_metadata. While this filter can be used to override or short-circuit the return of get_metadata(), it can't easily be used to filter the meta value. In the options API, get_option() has two hooks: pre_option_$option and option_$option. The get_{$meta_type}_metadata corresponds to the former, but it would be useful to have something similar to option_$option that will filter the actual meta value. Maybe get_{$meta_type}_metadata-{$meta_key}?

Attachments (2)

24726.patch (1.1 KB) - added by JD55 22 months ago.
24726.2.diff (1.9 KB) - added by MikeHansenMe 6 weeks ago.
Refresh and cleanup

Download all attachments as: .zip

Change History (5)

@JD5522 months ago

comment:1 @JD5522 months ago

  • Keywords has-patch added

Added patch with filter get_{$meta_type}_metadata-{$meta_key}.

comment:2 @nacin15 months ago

  • Component changed from General to Options and Meta

comment:3 @sc0ttkclark15 months ago

As the lead developer of the Pods project, I would also find this useful so we could only cover the fields that the user creates, instead of loading up the Pod config and checking if the field exists for that meta_key.

@MikeHansenMe6 weeks ago

Refresh and cleanup

Note: See TracTickets for help on using tickets.