Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save carlaizumibamford/bc87f5399c186cbddca5e6760dc6150b to your computer and use it in GitHub Desktop.
Save carlaizumibamford/bc87f5399c186cbddca5e6760dc6150b to your computer and use it in GitHub Desktop.
Making Alternative has_post_thumbnail() In WordPress
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