Without more information, it’s hard to tell what the reason is, for a specific answer you might want to show your code.
The following uploads the lady to the media library:
$url="https://res.cloudinary.com/demo/image/upload/w_400,h_400,c_crop,g_face,r_max/w_200/lady.jpg";
// $post_id = 0 to not attach to specific post
media_sideload_image( $url, 0 );
If you’re outside /wp-admin
, you’ll need:
require_once(ABSPATH . 'wp-admin/includes/media.php');
require_once(ABSPATH . 'wp-admin/includes/file.php');
require_once(ABSPATH . 'wp-admin/includes/image.php');
Consult the documentation for further information:
Related Posts:
- How do I disable responsive images in WP 4.4?
- Set default image sizes in WordPress to hard crop
- After Moving a Site to Another Domain, All Images Are Lost
- How to find attachment by it’s name?
- Change html structure of all img tags in WordPress
- How to disable “insert into post” only when selecting the Featured Image?
- Is there a way to define a default caption to all uploaded images
- How can I add the “Use as featured image” to a custom metabox?
- How to increase media image scale limit?
- Dynamic-Image-Resize Plugin does not output anything
- How to place an image into header.php? [closed]
- Uploading an image as featured image from frontend form
- How to upload images from my directory into my wordpress?
- Add a featured image in my theme?
- @wordpress/create-block image url in css
- How does WordPress work out the srcsets?
- How to include a picture in a blog post such that it will show in Facebook?
- Remove ‘wp-content/themes/themename/’ from Image path
- help getting featured image using get_posts
- Why html tags are being appended to my pictures?
- Why can I not view image attachment pages?
- Restrict Image Uploads to a Certain File Type
- wordpress media library shows empty images
- How to change the target size of images clicked on in WordPress standard gallery
- Image popup in a lightbox / overlay from the backend 3.5 admin area (plugin)
- media sideload image and Google Content
- Mobile Featured Image Bug
- How to display alt tags in img src?
- Big Image on Featured Post, Normal on Single Post
- Making images in posts link to the image file rather than the attachment page
- offload media to external services [closed]
- How to create ‘Local’ filters for WordPress srcset sizes in template parts?
- Imagick vs GD colour issues on image uploads
- How to add image and featured image to post by WP REST API
- Jetpack’s photon causes local site to try and serve images from WordPress CDN [closed]
- How to stop wordpress always displaying full-res images
- Transfer only original images to new site
- How to filter the image embed code based on link type
- WordPress PNG compression issue
- Fallback image size when using wp_get_attachment_image_src / full size compressed image
- Rewrite all article pictures to link to file
- Upload box media size not working
- Featured images disappear after DB export/import?
- I want to Add My Product Image to Admin Order Email in Woocommerece [closed]
- Remove Image Sizes in Media Settings Page
- Automatically Insert alt attribute above image has h2
- Rebuild thumbnails via WP Cli – how?
- Get ID for previous/next image link
- Changing Image Size Settings does not show in Image Details
- adding image to post thumbnail from another server
- Logo is not being displayed in header (Twentytwelve)
- Set Featured Image not opening – Stuck at loading
- Get the URL, width and height of an image where the width and height are a specified minimum
- Simple Local Avatar Plugin
- Metabox image upload value
- image_downsize returning an Array?
- Why is WordPress automatically modifying image URLs? (Tracking pixel from RSS)
- Always display a picture even if the link is broken?
- How to disable a WP Image Block to link to itself?
- How to remove image size inline style in article and include caption
- Is there a layout to place 2 same sized images in two columns on the WordPress page?
- How to change an image source when rendering on frontend?
- Images going blank after a while
- Confused about image sizes generated by WordPress
- Allow users to upload and display multiple photos
- Do I need to re-register all my images in the media library after a migration?
- How can I change the header on the pages?
- WordPress on IIS works except for image upload widget: Win 10 Pro
- still need help-images inside wp-content/ uploads/ are not showing up in my media library and uploaded using FTP protocol
- ADD class to all my images (thumbail)
- How to show a full page when someone links directly to an image on my site
- The image keep redirect to my previous URL after I moving my site
- Image sizes reset when changing theme
- How to get featured image of last post in a category?
- How can I add “alt” tag to element?
- After moving a site to new hosting, not all images are showing in media library
- Recovered WordPress installation (on localhost) links broken and images not showing
- Custom Background for each page and post
- How can the alt be added to this wooCommerce category image?
- Media sizes do not appear
- How to make Facebook share the featuterd image from url on WordPress
- Changing current post image uls with a function
- Delete images of a particular size
- How to watermark wordpress images from wp-content/uploads folder with htaccess and php?
- How to display every pictures from all the posts on one page?
- How to add multiple images in a page
- Images not rendering
- Retrieving Image Storage path
- Add category description to list of category with taxonomy image
- how to display all images from their siblings/ from same parent?
- How do I get the URL of only the first picture in a WordPress post?
- Specify what to do for a specific image number of the post
- adding images to wordpress pagination?
- How do you change all images dimensions to have the same size?
- Images getting corrupt automatically
- Thumbnail size keeps resetting automatically
- Media Library shows default image instead of image preview
- Profile Image displaying on Wrong side of WordPress Navigation Menu
- Uploading media to wordpress API with C# HttpClient
- How to add image alt attribute to the thumbnail code