skip to Main Content

is it possibile to post in wordpress the featured image as hotlink (external url), without hosting the image on the server?

See the line that should be fixed:

"featured_image": 'https://upload.wikimedia.org/wikipedia/it/f/fc/Pippo_Disney.png'

in

postDict = {
    "title": 'Hi',
    "content": 'My Content',
    "date": '2020-08-17T10:16:34',
    "featured_image": 'https://upload.wikimedia.org/wikipedia/it/f/fc/Pippo_Disney.png', # IMPORTANT
}

If it is not possibile, any ideas to do that is really welcome, thank you

3

Answers


  1. By default, WordPress doesn’t support external links for featured images. However, there’re some plugins implementing this feature:

    You’ll have to research their source code to understand how to use them from the REST API.

    Login or Signup to reply.
  2. There is a simple trick for this. You can paste a link for external img for example to excerpt, and then you can get this url by using get_the_excerpt
    https://developer.wordpress.org/reference/functions/get_the_excerpt/.
    In posts listing use

    <img src="<?php echo get_the_excerpt( $post_id ); ?>">
    
    Login or Signup to reply.
  3. Just insert image as HTML and it will auto-make it the featured image
    "<img src={img} width="900" height="400" />"

    https://wordpress.org/plugins/auto-post-thumbnail/
    (Use old version of plugin, New version is broken)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search