Created
September 26, 2022 12:05
-
-
Save encoderit-arman/27f14c45513872918b83a0e69c72a6ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global $wpdb; | |
return intval( $wpdb->get_var( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_value LIKE '%/$filename'" ) ); | |
courtesy: https://poanchen.github.io/blog/2017/04/10/how-to-check-if-an-image-already-existed-in-wp-content-upload-directory |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment