Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#40318 closed enhancement (fixed)

Document valid `type` parameters in register_meta() arguments

Reported by: iandunn Owned by: rmccue
Priority: normal Milestone: 4.8
Component: Options, Meta APIs Version: 4.7
Severity: minor Keywords: has-patch commit
Cc: Focuses: docs

Description

The valid types aren't documented, so I had to go digging through the source to find them.

The REST API defines them as 'string', 'boolean', 'integer', 'number' in
class-wp-rest-meta-fields.php

I haven't verified that there aren't other valid types used outside the API.

Attachments (2)

40318.diff​ (812 bytes ) - added by iandunn 10 years ago.
40318.patch​ (791 bytes ) - added by priyankabehera155 10 years ago.

Download all attachments as: .zip

Change History (9)

#1 @iandunn
10 years ago

  • Keywords has-patch added
  • Severity normal → minor

#3 @priyankabehera155
10 years ago

Hi @SergeyBiryukov

Added the valid types for the register_setting() function.

Thank you

#4 @jbpaul17
10 years ago

  • Keywords needs-testing added

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


10 years ago

#6 @rmccue
10 years ago

  • Keywords commit added; needs-testing removed
  • Version → 4.7

type was only introduced with the REST API in 4.7, so shouldn't be any other valid types outside of this.

Patches look good to me.

#7 @rmccue
10 years ago

  • Owner set to rmccue
  • Resolution → fixed
  • Status new → closed

In 40603:

Options/Meta: Document valid types for registration.

In 4.7, the REST API introduced types for options and meta passed into the registration functions. This adds the documentation for those types.

Props iandunn, priyankabehera155.
Fixes #40318.

Note: See TracTickets for help on using tickets.