update_callback is not working in register_rest_field
update_callback is not working in register_rest_field
update_callback is not working in register_rest_field
I think this could be handled with wp_set_object_terms() call on save_post_{$post->post_type} action. Using the post type specific action you’ll only target your cpt. The action provides bool $update parameter, which can be used to check, if the action is fired for a new post or on update. Passing an empty $terms value to the function … Read more
most likely you should not. (ok, “don’t have to” is a better phrasing) nonce in meta box do not add any security as the whole submittion of the form happens only after the form’s nonce is verified. You might need some hidden input to be able to detect when the save filter is called from … Read more
Creating an installation zip file
Mock a dependency of a WP_REST_Controller class
I have found my typo – It should be const ALLOWED_BLOCKS = [“grid/item”, “core/image”]; not const ALLOWED_BLOCKS = [“grid/item, core/image”]; If the allowed block type does not exist it only makes sense not to display a button to add more blocks 😀
thanks Lisa Cerilli, for the link I gave you a base on how to do it… I made some adjustments… but it helped a lot, follow my answer in the front html it was like this/ php :here I list the post and the link to favorite <?php while ( $list_plans->have_posts() ) : ?> <?php … Read more
full documentation listing all of the possible keys you can provide for $args when calling register_rest_route, just as you have it with register_post_type register_rest_route(), as of writing, doesn’t have such a documentation; however, you can call $request->get_attributes() inside of your endpoint callback to get the full (registration) options (including those not explicitly specified) for that … Read more
Not sure if there’s a better way to do it, but you can use the theme_<post type>_templates filter to add your custom template to the “Template” dropdown, and then use the template_include filter to ensure the correct file is loaded. So something like this should work: add_filter( ‘template_include’, ‘my_events_template_include’ ); function my_events_template_include( $template ) { … Read more
Developing the save function in Gutenberg blocks