WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 5 months ago

#37349 new enhancement

Allow sanitize_meta() to filter the meta_value regardless of meta_key

Reported by: mattkeys Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5.3
Component: Options, Meta APIs Keywords: has-patch
Focuses: Cc:
PR Number:

Description

I have created a couple of custom DB tables to handle storing a custom data type, and the meta for that data type. I modeled my meta table off of the WP postmeta/usermeta/etc standards so that I can use get_metadata and update_metadata functions and leverage all of their abilities.

Part of the update_metadata function is a call to sanitize_meta which lets you add filters in to sanitize the data in the format of: "sanitize_{$meta_type}_meta_{$meta_key}".

For the meta that I will be storing, I would like to apply a filter to ALL meta for my $meta_type, in the format of: "sanitize_{$meta_type}_meta".

Attachments (1)

meta.diff (1.8 KB) - added by mattkeys 3 years ago.
Adding two new filters to sanitize_meta to allow for filtering of all meta values regardless of meta key

Download all attachments as: .zip

Change History (2)

@mattkeys
3 years ago

Adding two new filters to sanitize_meta to allow for filtering of all meta values regardless of meta key

#1 @mattkeys
3 years ago

  • Keywords has-patch added
Note: See TracTickets for help on using tickets.