Make WordPress Core

Opened 10 years ago

Last modified 6 years ago

#29082 reviewing enhancement

Pass $meta_id into sanitize_meta() and subsequently into the filter for register_meta callback

Reported by: sc0ttkclark's profile sc0ttkclark Owned by: chriscct7's profile chriscct7
Milestone: Priority: normal
Severity: normal Version: 3.3
Component: Options, Meta APIs Keywords: has-patch
Focuses: Cc:

Description

To use Post Type based sanitization for specific meta keys, currently register_meta adds the filter but while the 'auth' filter gets access to the Post ID, the 'sanitize' filter does not. We would need to add $object_id in the cases of add/update_metadata, and in the case of update_metadata_by_mid we'd need to pass the Post ID into that function as well, which would then pass along to sanitize_meta() usage.

Is anyone against this proposal? If so, a patch can be drawn up.

Attachments (1)

29082.patch (2.8 KB) - added by jrf 9 years ago.

Download all attachments as: .zip

Change History (6)

#1 @sc0ttkclark
10 years ago

  • Component changed from General to Options, Meta APIs

#2 @chriscct7
9 years ago

  • Keywords needs-patch added

@jrf
9 years ago

#3 @jrf
9 years ago

  • Keywords has-patch added; needs-patch removed

#4 @jrf
9 years ago

Makes sense to me and I see no issues with backward compatibility.
Only issue would be direct calls to sanitize_meta(), but plugins should hook into the filter, so I don't actually expect an issue with that.

Added a patch implementing @sc0ttkclark's suggestion.

#5 @chriscct7
9 years ago

  • Owner set to chriscct7
  • Status changed from new to reviewing
Note: See TracTickets for help on using tickets.