Answer the question
In order to leave comments, you need to log in
How to make taxonomy assignment selection on request to rest api?
Hello guys, I'm doing such a thing, in general I have some kind of taxonomy based on tags in wordpress, in the fucntion.php file of the theme I have the following code:
function get_tags_swagger( WP_REST_Request $request ){
$result = wp_remote_request('http://swagger/v1.0/tags?term=' . $request['query_term'] ); // urlencode
if( empty( $result ) ){
return new WP_Error( 'no_author_posts', 'Записей не найдено', [ 'status' => 404 ] );
}
return json_decode($result['body']);
}
add_action( 'rest_api_init', function(){
register_rest_route( 'swagger', '/tags/(?P<query_term>[\S-]+)', [
'methods' => 'GET',
'callback' => 'get_tags_swagger',
] );
} );
Answer the question
In order to leave comments, you need to log in
In the admin panel, use jqury to pull this method with ajax, and append the result to your acf field. You will have an empty acf field in which you will append the result. Just bind xs as best, if through the key it will be necessary to do export and import of the field during transfers so that nothing breaks
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question