Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#38393 closed task (blessed) (fixed)

Add support for "integer" type for meta and options

Reported by: flixos90's profile flixos90 Owned by: joehoyle's profile joehoyle
Milestone: 4.7 Priority: normal
Severity: normal Version:
Component: REST API Keywords: has-patch
Focuses: Cc:

Description

Currently the REST API only supports string, number and boolean for metadata and options (in other words, the type argument you specify in register_meta() and register_setting() respectively). However, JSON schema also supports integer in addition, so I think it's essential we need to support it as well (number means float, for that matter).

To make it easier for PHP developers, we could even consider supporting float (and automatically adjust that to number), since the term number doesn't sound too specific regarding its actual scalar type.

Attachments (2)

38393.diff (1.4 KB) - added by flixos90 8 years ago.
38393.2.diff (2.4 KB) - added by flixos90 8 years ago.

Download all attachments as: .zip

Change History (10)

@flixos90
8 years ago

#1 @flixos90
8 years ago

  • Keywords has-patch added; needs-patch removed

38393.diff adds support for the integer type to be used with the REST API.

@flixos90
8 years ago

#2 @flixos90
8 years ago

38393.2.diff also updates the relevant register_setting() calls to use integer instead of number (all of the three fields are integers, not floats).

This ticket was mentioned in Slack in #core-restapi by rachelbaker. View the logs.


8 years ago

#4 @rachelbaker
8 years ago

  • Milestone changed from Awaiting Review to 4.7
  • Owner set to joehoyle
  • Status changed from new to assigned

Assigning to @joehoyle to review and milestone

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


8 years ago

#6 @azaozz
8 years ago

  • Type changed from enhancement to task (blessed)

#7 @joehoyle
8 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 39058:

REST API: Add support for "integer" type for meta and options

Previously Settings only supported "number" which meant it was possible to push floats to things like posts_per_page. This means now developers can also specify type => ineger in meta nad settings resgration.

Props flixos90.
Fixes #38393.

This ticket was mentioned in Slack in #core-restapi by flixos90. View the logs.


7 years ago

Note: See TracTickets for help on using tickets.