Make WordPress Core


Ignore:
Timestamp:
10/31/2016 04:06:54 PM (8 years ago)
Author:
joehoyle
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/option.php

    r38971 r39058  
    17821782    register_setting( 'general', 'start_of_week', array(
    17831783        'show_in_rest' => true,
    1784         'type'         => 'number',
     1784        'type'         => 'integer',
    17851785        'description'  => __( 'A day number of the week that the week should start on.' ),
    17861786    ) );
     
    18041804    register_setting( 'writing', 'default_category', array(
    18051805        'show_in_rest' => true,
    1806         'type'         => 'number',
     1806        'type'         => 'integer',
    18071807        'description'  => __( 'Default category.' ),
    18081808    ) );
     
    18161816    register_setting( 'reading', 'posts_per_page', array(
    18171817        'show_in_rest' => true,
    1818         'type'         => 'number',
     1818        'type'         => 'integer',
    18191819        'description'  => __( 'Blog pages show at most.' ),
    18201820        'default'      => 10,
Note: See TracChangeset for help on using the changeset viewer.