Using file_exists to check file in Uploads
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 ) ) { //… } … Read more