Last active
May 11, 2022 01:56
-
-
Save carlaizumibamford/bc87f5399c186cbddca5e6760dc6150b to your computer and use it in GitHub Desktop.
Making Alternative has_post_thumbnail() In WordPress
This file contains 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
Instead of | |
if ( has_post_thumbnail() ) { | |
} | |
use this code | |
$featured_image_url = wp_get_attachment_url( get_post_thumbnail_id( get_the_ID() ) ); | |
if ( ! empty( $featured_image_url ) ) { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment