Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

wp get acf category in post

<?php 
  $categories= get_the_category();
  if (!empty($categories)) {
    $term_id = $categories[0]->term_id;
    $image = get_field('category-image-field', 'term_'.$term_id);
    // what you do from here depends on what the field is returning
  }
?>
Source by support.advancedcustomfields.com #
 
PREVIOUS NEXT
Tagged: #wp #acf #category #post
ADD COMMENT
Topic
Name
3+4 =