Make WordPress Core

Changeset 59880


Ignore:
Timestamp:
02/27/2025 03:37:22 AM (4 weeks ago)
Author:
Mamaduka
Message:

REST API: Add the site reading options to the index.

Exposes page_for_posts, page_on_front and show_on_front reading settings via REST API index.

Props mamaduka, audrasjb, spacedmonkey, timothyblynjacobs.
Fixes #63023.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/class-wp-rest-server.php

    r59032 r59880  
    13721372            'gmt_offset'      => get_option( 'gmt_offset' ),
    13731373            'timezone_string' => get_option( 'timezone_string' ),
     1374            'page_for_posts'  => (int) get_option( 'page_for_posts' ),
     1375            'page_on_front'   => (int) get_option( 'page_on_front' ),
     1376            'show_on_front'   => get_option( 'show_on_front' ),
    13741377            'namespaces'      => array_keys( $this->namespaces ),
    13751378            'authentication'  => array(),
  • trunk/tests/phpunit/tests/rest-api/rest-server.php

    r59032 r59880  
    11381138        $this->assertArrayHasKey( 'gmt_offset', $data );
    11391139        $this->assertArrayHasKey( 'timezone_string', $data );
     1140        $this->assertArrayHasKey( 'page_for_posts', $data );
     1141        $this->assertArrayHasKey( 'page_on_front', $data );
     1142        $this->assertArrayHasKey( 'show_on_front', $data );
    11401143        $this->assertArrayHasKey( 'namespaces', $data );
    11411144        $this->assertArrayHasKey( 'authentication', $data );
  • trunk/tests/qunit/fixtures/wp-api-generated.js

    r59801 r59880  
    1313    "gmt_offset": "0",
    1414    "timezone_string": "",
     15    "page_for_posts": 0,
     16    "page_on_front": 0,
     17    "show_on_front": "posts",
    1518    "namespaces": [
    1619        "oembed/1.0",
Note: See TracChangeset for help on using the changeset viewer.