Passing Meta array in wp-rest api
Passing Meta array in wp-rest api
Passing Meta array in wp-rest api
Create multiple posts with WP REST API at once
Building custom API and using wp_get_nav_menu_items to get menu items. Only works when logged in, returns nothing when I’m not
Ended up developing a plugin using AJAX to make the calls to the API
You need javascript code that make ajax request (after click on item from list) and display data from response. You will need also function that receive object ID from request and prepare response. Add function to action hook wp_ajax_nopriv_my_action add_action( ‘wp_ajax_nopriv_my_action’, ‘my_action’ ); function my_action() { $output=””; if ( isset($_POST[‘object_id’] ) { // prepare output … Read more
Inserting Schema Markup (JSON-LD) Manually with Custom Fields or any Better Ways?
You should use register_meta to add the meta field to the rest controller. Here the example from the link to expose the field my_meta of the custom post type my_article: register_meta(‘post’, ‘my_meta’, [ ‘object_subtype’ => ‘my_article’, ‘show_in_rest’ => true ]);
Gutenberg : in the backend, I just want to store a JSON object
Formating content rendered from wordpress REST API as JSON and not HTML
While the docs state: Note that the API cannot prevent you from changing responses, but the code is structured to strongly discourage this. Internally, field registration is powered by filters, and these can be used if you absolutely have no other choice. there IS another choice for most cases, namely: custom endpoints/routes. You can even … Read more