本文档介绍了 WordPress REST API 中站点设置(Site Settings)的架构、字段定义以及相关操作端点。站点设置包含网站标题、描述、URL、时区、语言、显示选项等核心配置信息,可通过 GET 和 POST 请求进行查询和更新。
GET /wp/v2/settings
$ curl https://example.com/wp-json/wp/v2/settings
POST /wp/v2/settings The schema defines all the fields that exist within a Site Setting record. Any response from these endpoints can be expected to contain the fields below unless the `_filter` query parameter is used or the schema field only appears in a specific context.
title
|
Site title.
JSON data type: string Context: |
description
|
Site tagline.
JSON data type: string Context: |
url
|
Site URL.
JSON data type: string, Context: |
email
|
This address is used for admin purposes, like new user notification.
JSON data type: string, Context: |
timezone
|
A city in the same timezone as you.
JSON data type: string Context: |
date_format
|
A date format for all date strings.
JSON data type: string Context: |
time_format
|
A time format for all time strings.
JSON data type: string Context: |
start_of_week
|
A day number of the week that the week should start on.
JSON data type: integer Context: |
language
|
WordPress locale code.
JSON data type: string Context: |
use_smilies
|
Convert emoticons like 🙂 and 😛 to graphics on display.
JSON data type: boolean Context: |
default_category
|
Default post category.
JSON data type: integer Context: |
default_post_format
|
Default post format.
JSON data type: string Context: |
posts_per_page
|
Blog pages show at most.
JSON data type: integer Context: |
show_on_front
|
What to show on the front page
JSON data type: string Context: |
page_on_front
|
The ID of the page that should be displayed on the front page
JSON data type: integer Context: |
page_for_posts
|
The ID of the page that should display the latest posts
JSON data type: integer Context: |
default_ping_status
|
Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.
JSON data type: string Context: One of: |
default_comment_status
|
Allow people to submit comments on new posts.
JSON data type: string Context: One of: |
site_logo
|
Site logo.
JSON data type: integer Context: |
site_icon
|
Site icon.
JSON data type: integer Context: |
GET /wp/v2/settings
Query this endpoint to retrieve a specific Site Setting record.
$ curl https://example.com/wp-json/wp/v2/settings
<a href="#schema-title">title</a>
|
Site title. |
<a href="#schema-description">description</a>
|
Site tagline. |
<a href="#schema-url">url</a>
|
Site URL. |
<a href="#schema-email">email</a>
|
This address is used for admin purposes, like new user notification. |
<a href="#schema-timezone">timezone</a>
|
A city in the same timezone as you. |
<a href="#schema-date_format">date_format</a>
|
A date format for all date strings. |
<a href="#schema-time_format">time_format</a>
|
A time format for all time strings. |
<a href="#schema-start_of_week">start_of_week</a>
|
A day number of the week that the week should start on. |
<a href="#schema-language">language</a>
|
WordPress locale code. |
<a href="#schema-use_smilies">use_smilies</a>
|
Convert emoticons like 🙂 and 😛 to graphics on display. |
<a href="#schema-default_category">default_category</a>
|
Default post category. |
<a href="#schema-default_post_format">default_post_format</a>
|
Default post format. |
<a href="#schema-posts_per_page">posts_per_page</a>
|
Blog pages show at most. |
<a href="#schema-show_on_front">show_on_front</a>
|
What to show on the front page |
<a href="#schema-page_on_front">page_on_front</a>
|
The ID of the page that should be displayed on the front page |
<a href="#schema-page_for_posts">page_for_posts</a>
|
The ID of the page that should display the latest posts |
<a href="#schema-default_ping_status">default_ping_status</a>
|
Allow link notifications from other blogs (pingbacks and trackbacks) on new articles. One of: open, closed
|
<a href="#schema-default_comment_status">default_comment_status</a>
|
Allow people to submit comments on new posts. One of: open, closed
|
<a href="#schema-site_logo">site_logo</a>
|
Site logo. |
<a href="#schema-site_icon">site_icon</a>
|
Site icon. |
POST /wp/v2/settings