Home › Forums › General Issues › Add image as background-image inline style › Reply To: Add image as background-image inline style
The value of $post_id depends on what version of ACF you are using.
In ACF 4 or < 5.5.0
$image = get_field('cck_menu_category_image', $category->taxonomy.'_'.$category->term_id );
In ACF >= 5.5.0 you can use the above or you can use
$image = get_field('cck_menu_category_image', 'term_'.$category->term_id );
I think that you might also be able to use (but I’m not sure)
$image = get_field('cck_menu_category_image', $category);
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.