Make WordPress Core

Changeset 53590


Ignore:
Timestamp:
06/29/2022 02:22:56 PM (4 years ago)
Author:
SergeyBiryukov
Message:

REST API: Add missing options to the settings endpoint.

This adds the show_on_front, page_on_front, and page_for_posts options to the settings endpoint that were missed during WP 6.0 backports.

Related PR from Gutenberg repository:

Props Mamaduka, spacedmonkey, gziolo, jameskoster, SergeyBiryukov.
Merges [53588] and [53589] to the 6.0 branch.
See #56058.

Location:
branches/6.0
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/6.0

  • branches/6.0/src/wp-includes/option.php

    r53317 r53590  
    20642064 *
    20652065 * @since 4.7.0
     2066 * @since 6.1.0 The `show_on_front`, `page_on_front`, and `page_for_posts` options were added.
    20662067 */
    20672068function register_initial_settings() {
     
    22222223
    22232224        register_setting(
     2225                'reading',
     2226                'show_on_front',
     2227                array(
     2228                        'show_in_rest' => true,
     2229                        'type'         => 'string',
     2230                        'description'  => __( 'What to show on the front page' ),
     2231                )
     2232        );
     2233
     2234        register_setting(
     2235                'reading',
     2236                'page_on_front',
     2237                array(
     2238                        'show_in_rest' => true,
     2239                        'type'         => 'integer',
     2240                        'description'  => __( 'The ID of the page that should be displayed on the front page' ),
     2241                )
     2242        );
     2243
     2244        register_setting(
     2245                'reading',
     2246                'page_for_posts',
     2247                array(
     2248                        'show_in_rest' => true,
     2249                        'type'         => 'integer',
     2250                        'description'  => __( 'The ID of the page that should display the latest posts' ),
     2251                )
     2252        );
     2253
     2254        register_setting(
    22242255                'discussion',
    22252256                'default_ping_status',
  • branches/6.0/tests/phpunit/tests/rest-api/rest-settings-controller.php

    r52434 r53590  
    107107                        'default_post_format',
    108108                        'posts_per_page',
     109                        'show_on_front',
     110                        'page_on_front',
     111                        'page_for_posts',
    109112                        'default_ping_status',
    110113                        'default_comment_status',
  • branches/6.0/tests/qunit/fixtures/wp-api-generated.js

    r53333 r53590  
    96299629                            "required": false
    96309630                        },
     9631                        "show_on_front": {
     9632                            "description": "What to show on the front page",
     9633                            "type": "string",
     9634                            "required": false
     9635                        },
     9636                        "page_on_front": {
     9637                            "description": "The ID of the page that should be displayed on the front page",
     9638                            "type": "integer",
     9639                            "required": false
     9640                        },
     9641                        "page_for_posts": {
     9642                            "description": "The ID of the page that should display the latest posts",
     9643                            "type": "integer",
     9644                            "required": false
     9645                        },
    96319646                        "default_ping_status": {
    96329647                            "description": "Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.",
     
    1228412299    "default_post_format": "0",
    1228512300    "posts_per_page": 10,
     12301    "show_on_front": "posts",
     12302    "page_on_front": 0,
     12303    "page_for_posts": 0,
    1228612304    "default_ping_status": "open",
    1228712305    "default_comment_status": "open",
Note: See TracChangeset for help on using the changeset viewer.