elvishp2006 / carbon-field-rest-api-select
Carbon Fields extension, that adds a rest_api_select field type.
Package info
github.com/elvishp2006/carbon-field-rest-api-select
Language:JavaScript
pkg:composer/elvishp2006/carbon-field-rest-api-select
v0.4.1
2019-05-21 17:08 UTC
Requires
- htmlburger/carbon-fields: 2.2.0
Requires (Dev)
This package is auto-updated.
Last update: 2026-06-11 18:12:03 UTC
README
Disponibilize the rest_api_select field that fill options using the WP REST API.
Installing
composer require elvishp2006/carbon-field-rest-api-select
Example
Field::make( 'rest_api_select', 'id', __( 'Post' ) ) ->set_endpoint_label_path( 'title.rendered' ) // Default: 'title.rendered' ->set_endpoint_value_path( 'id' ) // Default 'id' ->set_endpoint_search_param( 'search' ) // Default 'search' ->set_endpoint_params( [ 'per_page' => 20, 'orderby' => 'relevance', ] ) ->set_endpoint( rest_url( 'wp/v2/posts' ) )