Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 16 months ago

#44902 closed defect (bug) (duplicate)

Update codex doc for function register_taxonomy

Reported by: ercartman Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9.8
Component: Taxonomy Keywords: needs-docs
Focuses: docs Cc:


I registered a new taxonomy.

And added post_categories_meta_box to my post type.

But if I saved the post with a taxonomy, an error occurred.

Created new taxonomy with name = id of selected taxonomy.

I checked the errors and found that on my server the $_POST data is transmitted with the type string

But custom taxonomy does not sanitize values by default.

I found param meta_box_sanitize_cb in WordPress source and added to attr when I call a function register_taxonomy:

'meta_box_sanitize_cb' => 'taxonomy_meta_box_sanitize_cb_checkboxes'

After that, the save works without errors.

Please, add this param to documentation.

Change History (3)

#1 @mukesh27
3 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #36514.

#2 @netweb
3 years ago

  • Milestone Awaiting Review deleted

Just to note, the docs added in #36514/r42211 will be shipped in WordPress 5.0, when 5.0 is released the documentation will be updated with this info.

#3 @desrosj
16 months ago

  • Keywords needs-dev-note removed

Since this was closed out as a duplicate, I'm removing needs-dev-note. However, the ticket this one was closed in favor of did receive a developer note, which can be found here: https://make.wordpress.org/core/2019/01/23/improved-taxonomy-metabox-sanitization-in-5-1/.

Note: See TracTickets for help on using tickets.