How can I use React packages with the clasic editor?

I solved this by reading from the DOM. Not the prettiest way but it does what I needed. const CustomUpdateComponent = {…}; document.addEventListener(‘DOMContentLoaded’, () => { // replace update button with our own const publishingActionButton = document.querySelector( ‘#publishing-action’ ); if (publishingActionButton) { const postId = document.querySelector( ‘#post_ID’ ).value; render( <CustomUpdateComponent post={postId} … />, publishingActionButton ); … Read more

Update Custom Post Type Metadata Wp Rest API

If you’re supplying the request data/body like so, which is an array of metadata: { metadata: { wishlist_array: “add this”, foo: “bar baz” } } and you want to update only the wishlist_array metadata, then you could do: // In your case, $field_value is the `metadata` value and $data is a WP_Post object. ‘update_callback’ => … Read more

wordpress api make 2 custom post type with single request

Please write function for get post by title function get_page_by_post_title( $page_title, $output = OBJECT, $post_type=”page” ) { global $wpdb; $sql = $wpdb->prepare( ” SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type = %s ORDER BY ID DESC “, $page_title, $post_type ); $page = $wpdb->get_var( $sql ); if ( $page ) { return get_post( … Read more