Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#40318 closed enhancement (fixed)

Document valid `type` parameters in register_meta() arguments

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

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 8 years ago.
40318.patch (791 bytes) - added by priyankabehera155 8 years ago.

Download all attachments as: .zip

Change History (9)

@iandunn
8 years ago

#1 @iandunn
8 years ago

  • Keywords has-patch added
  • Severity changed from normal to minor

#3 @priyankabehera155
8 years ago

Hi @SergeyBiryukov

Added the valid types for the register_setting() function.

Thank you

#4 @jbpaul17
7 years ago

  • Keywords needs-testing added

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


7 years ago

#6 @rmccue
7 years ago

  • Keywords commit added; needs-testing removed
  • Version set to 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
7 years ago

  • Owner set to rmccue
  • Resolution set to fixed
  • Status changed from new to 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.