이 플러그인은 최근 3개의 주요 워드프레스 출시와 시험 되지 않았습니다. 워드프레스의 좀 더 최근 버전으로 이용할 때 더 이상 관리되지 않고 지원되지 않고 호환성 문제가 있을 수 있습니다.

REST API Enabler

설명

Like this plugin? Please consider leaving a 5-star review.

By default, custom post types and custom fields are not accessible via the WordPress REST API. REST API Enabler allows you to:

  1. Enable the WP REST API for custom post types and specify WP REST API custom endpoints.
  2. Choose which custom fields to include in WP REST API responses for posts, pages, and custom post types.

All enabled custom field data is included in the REST API response, nested under the rest_api_enabler key, like so:

[
  {
    "id": 179,
    "date": "2016-07-03T18:06:50",
    "title": {
      "rendered": "Test Job"
    },
    .
    .
    .
    "rest_api_enabler": {
      "custom_meta_1": "Value 1",
      "custom_meta_2": "Value 2",
      "custom_meta_3": [
        "Array value 1",
        "Array value 2"
      ]
    }
  }
]

Note: prior to verion 1.1.0, all meta keys were included as top-level keys in the API response. Additionally, all values were returned as arrays, regardless of whether the original value was actually an array. This functionality is now deprecated as it risks key-name collisions. Please reference the rest_api_enabler top-level key instead.

사용방법

  1. Activate the plugin, then go to Settings → REST API Enabler in the admin.
  2. Click the Post Types tab to enable/disable post types and customize their endpoints.
  3. Click the Post Meta tab to enable/disable post meta (custom fields).

NOTE: by default, the plugin does not display settings for protected post meta (post meta that begins with an underscore and is intended for internal use only). If you wish to include protected post meta in the plugin settings, you can use the rae_include_protected_meta filter to do so. The following code can be placed in your theme’s functions.php file, or in a custom plugin (on init priority 10 or earlier):

add_filter( 'rae_include_protected_meta', '__return_true' );

스크린샷

  • Enabling post types and customizing their endpoints.

설치

Manual Installation

  1. Upload the entire /rest-api-enabler directory to the /wp-content/plugins/ directory.
  2. Activate REST API Enabler through the ‘Plugins’ menu in WordPress.

후기

2016년 9월 3일
Thank you, this is a very simple yet usefull plugin. saved me the time to create one my self
모든 3 평가 읽기

기여자 & 개발자

“REST API Enabler”(은)는 오픈 소스 소프트웨어입니다. 다음의 사람들이 이 플러그인에 기여하였습니다.

기여자

“REST API Enabler”(이)가 1(으)로 번역되었습니다. 기여해 주셔서 번역자님께 감사드립니다.

자국어로 “REST API Enabler”(을)를 번역하세요.

개발에 관심이 있으십니까?

코드 탐색하기는, SVN 저장소를 확인하시거나, 개발 기록RSS로 구독하세요.

변경이력

1.1.0

  • Add mapping of meta keys to be nested under the new top level rest_api_enabler response key. Note: top-level key support is still maintained, though now considered deprecated.
  • Add functionality to support singular and array values, to prevent issue in which ALL values were previously returned as arrays.

1.0.2

  • Fix issue in which media uploads via the REST API don’t work.

1.0.1

  • Fix typo preventing post meta enabling.
  • Fix post meta alphabetical sorting.

1.0.0

  • First release