I manage to solved it by adding this code (at the bottom) to the YOUR BLOG THEMES my path : wp-content/themes/MYWPTHEME/function.php
function ws_register_images_field() {
register_rest_field(
'post',
'images',
array(
'get_callback' => 'ws_get_images_urls',
'update_callback' => null,
'schema' => null,
)
);
}
add_action( 'rest_api_init', 'ws_register_images_field' );
function ws_get_images_urls( $object, $field_name, $request ) {
$medium = wp_get_attachment_image_src( get_post_thumbnail_id( $object->id ), 'medium' );
$medium_url = $medium['0'];
$large = wp_get_attachment_image_src( get_post_thumbnail_id( $object->id ), 'large' );
$large_url = $large['0'];
return array(
'medium' => $medium_url,
'large' => $large_url,
);
}
Related Posts:
- How get Themes list via REST api?
- Get the name WordPress default theme in the core
- How to refresh WordPress Customizer panel upon entering a value
- Disable Theme API / Front end (for API only environment)
- Multiple sub directories for theme template pages
- share wrordpress data between two shared hosts using REST API
- WP Customize API Checkbox change value
- Does WordPress provide themes_api function?
- Page structure using The Customizer Api
- How to Link External jQuery/Javascript files with WordPress
- Am I allowed to license my WordPress theme under the aGPL
- Best way to include Bootstrap in WordPress
- Best practices for a Style/CSS based theme options page?
- How to license my commercial WordPress theme? [closed]
- How to Use WordPress as Static CMS Without Blog Posts
- How do I create my own admin button and theme settings page?
- How to set two different themes on one WordPress? (Desktop vs. Mobile)
- How can I add a set featured image function to a theme that doesn’t already have it built in?
- Jquery in Child Theme
- Changing the visible url path to css & js files
- How to automatically highlight syntax of code in a post?
- Retaining old HTML archives and displaying themes conditionally
- Extra User Profile Field Upload File / Image
- Theme Activation, Create Database Tables
- Alternate header image
- Change logo on each page of University Hub theme [closed]
- How do you manage your theme versions when privately distributing?
- wordpress themes demo file importing problem? [closed]
- How to run word press theme on localhost in Ubuntu OS?
- Does uninstalling a WordPress theme delete its database values?
- Confit theme on WordPress.org
- Problem after renaming wordpress template file
- 100% width Featured Image Size
- Make it possible to pick a color theme for specific pages
- X-Axis of Site is Messed Up Because it is in Hebrew
- How can I use a logo in the header?
- How to create my own sidebar in Twenty Eleven child theme?
- How to find out if page_for_posts is showing (in order to style menu item)
- Exclude objects from WordPress API based from ACF field using rest_prepare_{$post_type}
- Set plugin-values when creating post via REST-API
- the_content() is not displaying content, why? [closed]
- Unwanted edit link on front page
- How to edit feature image with XML RPC?
- Need help with making a website where user can add products
- Permissions for installing themes and files in general?
- Frameworks for Premium Theming [duplicate]
- Remove problem PHP code entered into footer via Theme
- What is the “pub” theme? [closed]
- Twenty Seventeen search error
- Protect shortcodes, custom JS, and CSS from theme updates
- Using JQuery to check for Rel Attribute of Image before Overriding It
- Free WordPress theme for an intranet tutorial site [closed]
- How do you remove a broken theme from WordPress Admin (without FTP or Cpanel)
- WordPress HTTP API NTLM Authentication
- Is There A Plugin to Create WP Multisite Installs programatically
- Why are so many popular responsive WordPress themes “boxed” at 940px? [closed]
- Theme Modified By Updates
- I want to develop a theme using WordPress. Which theme should I start from or develop from scratch? [closed]
- Background image appears on localhost site but not online
- Remove Commenting on Certain Pages
- Pages and posts on ElegantTheme featured slider [closed]
- Error when installing theme – “failed to open stream: No such file or directory in…”
- disable default widgets in Responsive theme
- Theme seems to have different options on wordpress.com and own-server install
- how would I change background color of a theme using a plugin?
- Insert the current theme header into an external HTML/XHTML file
- How to use one git (github) repository for version control for multiple themes
- brand section in wordpress lost after change theme
- apiFetch() returns infinite requests
- Is there a way to call via javascript if a user is logged-in on a static html file?
- How i can put on my wordpress the demo of a theme?
- WordPress keeps switching back to empty template
- How do i post data to url with fields?
- Best way of creating a website with multiple themes/languages
- sidebar in 2020 theme as a widget
- Remove the breadcrums on a theme W
- WordPress API – sign-up to multiple Multisites from one single form
- WordPress ajax insert and delete if already inserted delete the post id stored in custom table
- Tinymce button is not visible for a theme
- I would like to retrive JSON value and display it in wordpress page or widget
- Serve resources from a consistent URL GT Metrix
- how to edit homepage
- Why does “if statement” has to “die()”, otherwise wont work?
- How to create REST Based JSON API(how to modify the code below)?
- WordPress Dashboard Problem [closed]
- Change the main width of Twenty Thirteen theme
- Meta title W3C Validation Error with
- Can I add a blog subfolder to my website and use a different theme
- How to prevent tinyMCE editor to be loaded completely in Text Editor?
- How to modify/ customise NextGen Gallery’s templates? [closed]
- Entire VPS locks up when using particular theme [closed]
- Overwrite template-tags.php in child theme
- Advice for a Newbie WordPress Web Designer/ Themes? [closed]
- Load all files from folder in theme – Security concerns?
- Basic clothing showroom [closed]
- How do I remove the dash (-) between my Site Title and Tagline?
- WordPress Theme redirects to the Index page – Theme customizer problem
- Obtaining the original unchanged Theme [closed]
- How to assign posts to different themes? [closed]
- problem with custom url for images as post