[wp-trac] [WordPress Trac] #43638: Introducing 'sanitize_post' filter
WordPress Trac
noreply at wordpress.org
Mon Mar 26 21:04:01 UTC 2018
#43638: Introducing 'sanitize_post' filter
-------------------------------+-----------------------------
Reporter: enrico.sorcinelli | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: trunk
Severity: normal | Keywords:
Focuses: |
-------------------------------+-----------------------------
I was trying to do a post field sanitization on new post insertions that
depended on the value of another field.
While it quite easy in administration context, using for example
`pre_{$field}` or `{$field_no_prefix}_save_pre` filters in conjunction to
`$_POST` and so on, it seems that there's no direct way using
`wp_insert_post` since the filters above do not have references to the
other fields or to the ID of the post (which is also useless in the case
of new posts) but only refers to the value to be sanitized.
So this enhancement aims to introduce new `sanitize_post` filter.
PS: Of course I could sanitize values directly in `wp_insert_post` but
only assuming I have control of the code or at the cost of duplicate the
sanitization in each `wp_insert_post` calls.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/43638>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list