wp_get_post_terms is difference obj model than the one in rest api response

I got fixed my problem by using the method prepare_item_for_response in WP_REST_Terms_Controller function custome_posts_response(WP_REST_Response $data, WP_POST $post, WP_REST_Request $request) { $newspapers = wp_get_post_terms($post->ID, ‘newspaper’); $categories = wp_get_post_terms($post->ID, ‘category’); $tags = wp_get_post_terms($post->ID, ‘post_tag’); $newspaper_ctrl = new WP_REST_Terms_Controller(‘newspaper’); $category_ctrl = new WP_REST_Terms_Controller(‘category’); $tags_ctrl = new WP_REST_Terms_Controller(‘post_tag’); $newspapers = array_map(function( WP_TERM $newspaper ) use ($newspaper_ctrl, $request) { return … Read more

Don’t know how to show custom taxonomies from a custom post_type

Ok, i did work for you: First, I registered custom post type and taxonomy: add_action(‘init’, ‘my_init’); add_action(‘admin_init’, ‘my_admin_init’); function my_admin_init() { $role = get_role( ‘administrator’ ); $role->add_cap( ‘edit_event’ ); $role->add_cap( ‘read_event’ ); $role->add_cap( ‘delete_event’ ); $role->add_cap( ‘edit_events’ ); $role->add_cap( ‘read_events’ ); $role->add_cap( ‘delete_events’ ); $role->add_cap( ‘edit_others_events’ ); $role->add_cap( ‘publish_events’ ); $role->add_cap( ‘read_private_events’ ); $role->add_cap( ‘delete_private_events’ … Read more

Unable to check if image uploaded by wp_image_editor exists using file_exists function

When I used your exact code on a local test site I was unable to save the resized image. This is because you’re passing a URL to wp_get_image_editor() instead of a path. You’re also passing a URL to pathinfo(), which also requires a path. $pathinfo = pathinfo( $uploaded[‘url’] ); $image = wp_get_image_editor( $uploaded[‘url’] ); The … Read more

adding custom user input fields in WordPress admin dashboard gives error The link you followed has expired. Please try again

That error messages means a failed admin nonce validation (check_admin_referer, which calls wp_nonce_ays). And you don’t actually need an extra nonce here: these are extra fields to be added to existing forms that already have their own nonces, and the one you’ve added just clashes with them. (If you were adding a new form you … Read more