Block error message in foreach loop when looping through ACF field

For those who are looking for an answer – after trial and error i found the “if” statement i was looking for. Full code as follows: $variablename = get_field(‘dcfg_global_item_select’); if ( !empty( $variablename ) ) {?> <div class=”container”> <?php foreach($variablename as $variablename2):?> <a href=”<?php echo get_page_link($variablename2 ->ID);?>”> <center> <img src=”<?php echo get_the_post_thumbnail_url($variablename2->ID, ‘medium’);?>”> </center> </a> … Read more

What is wp_get_post_tags for media tags?

If I understand correctly, wp_get_post_tags returns the “post_tags” taxonomy terms. Yes, except that the taxonomy is post_tag and not post_tags. How can I access “attachment_keywords” taxonomy terms? wp_get_post_tags() uses wp_get_post_terms(), so you would do the same for custom taxonomies. For example if the taxonomy (name/slug) is attachment_keywords, then: $tags = wp_get_post_terms( $post->ID, ‘attachment_keywords’ ); And … Read more