Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#38393 closed task (blessed) (fixed)

Add support for "integer" type for meta and options

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

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 10 years ago.
38393.2.diff (2.4 KB ) - added by flixos90 10 years ago.

Download all attachments as: .zip

Change History (10)

@flixos90
10 years ago

#1 @flixos90
10 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
10 years ago

#2 @flixos90
10 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.


10 years ago

#4 @rachelbaker
10 years ago

  • Milestone Awaiting Review4.7
  • Owner set to joehoyle
  • Status newassigned

Assigning to @joehoyle to review and milestone

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


10 years ago

#6 @azaozz
10 years ago

  • Type enhancementtask (blessed)

#7 @joehoyle
10 years ago

  • Resolutionfixed
  • Status assignedclosed

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.


9 years ago

Note: See TracTickets for help on using tickets.