Hi, I have been using CPT ui to create custom post type. I want to create a page for categories assgined to custom post type. I added catgory.php page and used below function to retrieve posts in custom post type.
add_filter('pre_get_posts', 'query_post_type');
function query_post_type($query)
{
if (is_category()) {
$post_type = get_query_var('post_type');
if ($post_type)
$post_type = $post_type;
else
$post_type = array('nav_menu_item', 'post', 'set_date', 'year_round'); // don't forget nav_menu_item to allow menus to work!
$query->set('post_type', $post_type);
return $query;
}
}
However, I have added an custom ACF field for taxanomy (category) where I can add image to it. When I run the get_field(‘hero_image’) in category.php page, im unable to get the image url. Why is that?