You can’t use a file url in file_exists()
like this:
file_exists( "http://example.com/wp-content/uploads/Example_Name_2_SM.jpg" );
You should rather use an absolute file path, for example:
file_exists( "/absolute/path/to/wp-content/uploads/Example_Name_2_SM.jpg" );
Then you should try
$meta = get_post_meta( $post->ID, '_meta_example_name', true );
$file = $upload_basedir . "https://wordpress.stackexchange.com/" . $meta . '_7_SM.jpg';
if ( file_exists( $file ) ) {
//...
}
where
$upload_basedir = WP_CONTENT_DIR . '/uploads';
or
$upload_dir = wp_upload_dir();
$upload_basedir = $upload_dir['basedir'];
Related Posts:
- Adding a custom image upload size and making it selected by default?
- Change the filename format of saved featured images
- How to register images uploaded via FTP in media library?
- Create Image Uploader for Widget
- Rename image uploads replacing “width” and “height” in filename with “medium”, “large”, “small”
- Rename image uploads with width in filename
- Debugging upload problem: What part of WP does actual image-resizing?
- How to resize image on client-side before upload?
- How to upload imagick resource to media in wordpress
- Adding a querystring to an image URL when clicking ‘insert into post’?
- Validate Uploaded Image using WordPress’ Built-in Functions?
- Get most recent media upload
- Convert all images to PNG on file upload
- Can’t upload image using media_sideload_image
- Upload multiple images to a Woocomerce product
- What is the alternative to “ when it comes to calling Media (image) files in the ‘attachment.php’ file?
- Enable custom logo upload if logo is not in header
- WordPress automatically adds links to uploaded images
- WordPress function when file is uploaded, deleted or edited
- Get featured image with custom size outside WordPress
- Images Uploaded saving onto older/previous year folders
- Convert canvas to image and upload image to server
- WordPress İmages Upload & Delete Error
- How to Make Thumbnail of Post Stay Animated
- Convert all uploaded PNG files to PNG-8 format
- Some problems in custom widget
- Checking page before applying image restrictions while uploading
- WordPress loading all local images from specific directory?
- Save the outputted image into the Media Library, with a different filename and extension
- How to resize an image server-side before upload?
- Name Input from widget displays Sidebar name instead of saved data
- How to automatically convert images to WebP on WordPress?
- Generate and upload screenshot as featured image for user-submitted post
- What’s the best way to use the Featured Image for responsive web design?
- Uploading media with the REST API
- Hide custom image sizes from media library
- Image Upload “exceeds the maximum upload size for this site”, but php.ini is correct
- Adding Featured Image to Post programatically
- Is it unsafe to put php in the /wp-content/uploads directory?
- Get a Page’s attachments in Gallery order
- Image upload via FTP to wordpress media library
- How to get custom image size for image uploaded in Customizer
- Restrict WordPress File Type Uploads by User Type
- Upload a json file in php [closed]
- Styling images coming from another blog
- IMG src weird behaviour inside a single post loop
- How to get media objects
- PHP code to call image Caption, Alternative Text, and Decription?
- Change the URL of an image from wp_get_attachment_image_src except in the frontpage
- Randomise upload filenames (or another solution to hide the original image URL from theft?)
- How to get specific image in media library with php
- hover image appears below placeholder instead of overlayed
- Add custom url to featured image
- Best practice for migration friendly images in posts/pages?
- How to upload a file to a folder named after the user_id via plugin
- Unread Repeater field IMG alt not working
- Accessing an image folder inside public web directory
- NGINX rewrite rules for multisite
- Change WordPress Upload Folder using wp handle upload
- How do I Import / Upload Files with jQuery AJAX?
- zip unzip attachments in wordpress
- Where are the src and srcset sizes coming from?
- HTML showing after PHP code in tag
- trying to get wp_get_attachment_url to output clickable link
- WordPress upload file size error even after raising php limits
- Get uploaded image and attach it to the new post
- Shortcode function doesnt work without caption
- Why is my max_upload_filesize being limited to 2M? [duplicate]
- Add valid XHTML closing img tags to WordPress galleries
- How to get the filename from file system and create a download link?
- How to decrease the max file upload size without using php.ini or htaccess?
- CSS images don’t show up with bloginfo
- Change image data durgin upload
- Problem with inserting multiple images in gallery of each WooCommerce product programmatically
- Change extension to .jpg when webp is not supported
- Prepend to all image URLs with PHP, only for mobile devices
- Configure WordPress to Use Responsive Image Rendering
- Replace background image with post thumbnail in shortcode
- Sudden Upload HTTP errors, PHP uploads and memory limits are already to high to my taste. Anything else?
- Get list of posts from attachment
- Get the image title and alt from custom query
- How to always display full size image
- I want url from a file in media using title file
- Crop an image after upload on custom account page
- media_handle_upload fails with gravity form submitted image
- Restrict File Type Uploads by User on Wordress via functions.php
- Retrieving specific images from Media Library
- Pass php to database in JQuery: With AJAX?
- WordPress will suddenly stop saving files uploaded by my code (ran in nopriv ajax)
- images in wordpress themes
- How to use custom fields to replace top-level parent title with an image using wp_list_pages?
- File Upload with Server in safe_mode
- Correct Syntax for uploading files to custom directory in WordPress
- How do I return an image from a script
- Display Post Titles on top of the_post_thumbnail()
- add if statement to the featured image
- Understanding responsive imagery
- bloginfo url in javascript
- WordPress directories not writable after PHP version upgrade
- Adding caption to all images inside an article