[wp-trac] [WordPress Trac] #36514: posting with custom taxes
WordPress Trac
noreply at wordpress.org
Sun Sep 25 19:11:30 UTC 2016
#36514: posting with custom taxes
-----------------------------------+-----------------------------
Reporter: hokku | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.7
Component: Taxonomy | Version: 4.2
Severity: normal | Resolution:
Keywords: 2nd-opinion has-patch | Focuses: administration
-----------------------------------+-----------------------------
Changes (by boonebgorges):
* keywords: needs-patch 2nd-opinion => 2nd-opinion has-patch
Comment:
> Ah, interesting. Do we break out much of the insert/update post process
right now? I feel like the last time I looked it was one giant procedural
call.
Yes, the way it's saved is a bit of a mess, and not easily separated from
`wp_insert_post()` without changing the order in which things happen. We
can simplify the improvement by asking for a sanitization callback
instead. See [attachment:36514.2.diff] for a proof-of-concept.
> In practice, I think it really ends up as three callbacks - single
(select, radio), multi (checkboxes, multi-select), and freeform input
(currently tags).
Yes, this covers the native HTML elements, but who knows what wacky stuff
people are doing inside of a `meta_box_cb`. In any case, the sanitize
callbacks are good for more than just differentiating between the *shape*
of the payload, they can also do specific validation on the *contents* of
the payload. Imagine, for instance, that you allowed users to provide a
comma-separated list of term IDs (not sure why you'd do this specifically,
but you get the idea). A generic `meta_box_sanitize_cb` allows you to do
whatever you want with your 'tax_input'.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36514#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list