Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#37340 closed task (blessed) (invalid)

Clarify inline documentation for object_subtype

Reported by: johnbillion Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6
Component: Options, Meta APIs Keywords: needs-patch needs-docs
Focuses: docs Cc:


#35658 introduced the concept (or at least the terminology) of an object subtype when registering meta fields. Reading the inline documentation, it's not at all clear what an object subtype is, or what value should be passed to this parameter.

 * @param string $object_type    The type of object.
 * @param string $object_subtype The subtype of the object type.

Documentation for the $object_subtype parameter for the following functions and filters needs to be improved and made consistent:

  • sanitize_meta()
  • register_meta()
  • registered_meta_key_exists()
  • unregister_meta_key()
  • get_registered_meta_keys()
  • get_registered_metadata()
  • sanitize_{$object_type}_{$object_subtype}_meta_{$meta_key} filter
  • sanitize_{$object_type}_meta_{$meta_key} filter

Change History (4)

#1 @jeremyfelt
4 years ago

Describing this in a clear way is going to be tough, but we should. :)

WP Core objects are post, user, comment, term.

  • Post subtypes are "post", "page", any custom post type slug.
  • Term subtypes are "category", "term", any custom taxonomy slug.
  • User subtypes are "user". We don't really have custom user types yet.
  • Comment subtypes are "comment". We don't really have registered comment types yet.

How do we wrap that up into a sentence or two?

This ticket was mentioned in Slack in #core by ocean90. View the logs.

4 years ago

#3 @jeremyfelt
4 years ago

We can close this ticket out if we move away from object subtypes in #35658.

#4 @jeremyfelt
4 years ago

  • Milestone 4.6 deleted
  • Resolution set to invalid
  • Status changed from new to closed

The explanation of subtype can wait until another day. :) All instances have been removed in [38095].

Note: See TracTickets for help on using tickets.