File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -923,14 +923,17 @@ public static function get_registered_sizes( $attachment_id = null ) {
923923 * @return int
924924 */
925925 public static function attachment_url_to_postid ( $ url ) {
926- $ attachment_id = 0 ;
926+ $ key = "postid_ {$ url }" ;
927+
927928 if ( function_exists ( 'wpcom_vip_attachment_url_to_postid ' ) ) {
928929 $ attachment_id = wpcom_vip_attachment_url_to_postid ( $ url );
930+ } else {
931+ $ attachment_id = wp_cache_get ( $ key , 'cloudinary ' );
929932 }
930933
931- if ( 0 === $ attachment_id && empty ( wp_cache_get ( " postid_ { $ url }" , ' cloudinary ' ) ) ) {
934+ if ( empty ( $ attachment_id ) ) {
932935 $ attachment_id = attachment_url_to_postid ( $ url ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.attachment_url_to_postid_attachment_url_to_postid
933- wp_cache_set ( " postid_ { $ url }" , $ attachment_id , 'cloudinary ' );
936+ wp_cache_set ( $ key , $ attachment_id , 'cloudinary ' );
934937 }
935938
936939 return $ attachment_id ;
You can’t perform that action at this time.
0 commit comments