Skip to content

Instantly share code, notes, and snippets.

@sunshinephotocart
Created October 5, 2023 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sunshinephotocart/aa1b28c54fdc2dc1ed9fb9bb8cd9b3f6 to your computer and use it in GitHub Desktop.
Save sunshinephotocart/aa1b28c54fdc2dc1ed9fb9bb8cd9b3f6 to your computer and use it in GitHub Desktop.
Show keywords for an image
add_action( 'sunshine_after_image', 'sunshine_show_image_keywords' );
function sunshine_show_image_keywords( $image ) {
$metadata = $image->get_meta_value( '_wp_attachment_metadata' );
if ( ! empty( $metadata['image_meta']['keywords'] ) ) {
echo join( ', ', $metadata['image_meta']['keywords'] );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment