I think you can just fetch it from the global query using get_queried_object:
function itunes_head() {
if ( is_category() ) {
$category = get_queried_object();
if ( isset( $category ) ) {
$acf_category = 'category_' . $category->term_id;
$field = get_field( 'my_category_field', $acf_category );
}
}
}
Related Posts:
- Remove tag on my RSS Feed
- custom rss templete
- Display ACF category image on archive and single template files
- Individual rss feed entry length for categories?
- Advantages and disadvantages of using automatic-feed-links
- functions.php inject inline css
- current_cat_ancestor Alternatives
- Show/hide Widgets in Dashboard Based on Current Advanced Custom Fields Option
- Add body class of category parent
- Changing a function in function.php to a shortcode – for listing categories of only a certain post type
- Php string not working in WordPress Functions.php (trying to fetch 1st category for each blog that post appears in the sidebar)
- Add class to Categories Widget
- How to Acheive the custom woocommerce category template
- Add a Post Thumbnail to an RSS Feed with custom size
- How to add a rel attribute to images that contains their categories?
- Assign category using custom field?
- How To Get WordPress Categories Link List?
- Changing post category from dropdown
- Manipulate Output of wp_list_something: select menu instead of li’s
- Make Categories a Dropdown Menu in Media Library
- How to use max and min values of custom fields
- How to add custom fields in rss feed
- Completely disable RSS feeds on WP 5.5.2 and show a 404 page instead of die();
- Programmatically Create Category and sub Category
- Attach parent category template to all subcategories
- exclude a category from a search on a specific page
- Get the category name outside of the loop in category.php
- Is it possible to change any of the HTML/URL returned from the_category()
- Possible to display shortcode based on the category?
- Unset Category if other Category is unset during post transition
- Retrieve tags data in post body
- Select pages by category
- Run function when WordPress new multisite is created or ACF field is updated
- Show Primary Category first when I display post categories
- Why is my page feed returning empty content?
- How do I hide or remove ‘Category’ from wordpress breadcrumbs
- How to remove style attribute in WordPress RSS output?
- Get Current Post ID in functions php, meta query filter
- Run wp_kses_decode_entities on atom feed?
- Get category URL for current post
- allow only one post in specific category
- ACF not showing
- How to obtain the recent posts without their content in an efficient way?
- Running script based on Category
- Remove a category from a post when saving a new post
- How to fix get_the_category function returning incorrect slug?
- Return category name with & Ampersand doesnt work
- Add php code to wp_print_scripts?
- Randomizing wp_tag_cloud() in child theme
- How replace individual elements in the RSS feed with a single string
- Programmatically add Yoast meta description after post save
- How to rewrite wordpress search to work on specific category
- Compare meta key to current date in pre get post
- Image loading function not working on archive.php template
- Exclude Category ID in function
- Problem with calling custom function in a foreach loop
- “All posts” in the category widget
- Get Attachment Category Name
- Using two loops in one WordPress template
- Insert a field with PREG_REPLACE – strange behaviour
- WordPress Categories: Function using custom SQL to return array of specific category IDs
- Get slug of current category in functions.php
- Featured Image and Tags problem
- Is posible to redirect a few URL?
- Use a filter for wp_robots to block CPT/feed/
- Completely Disable WordPress RSS Feeds
- Override a Post’s URL with Advanced Custom Fields Function
- How to fetch common posts from two feeds?
- WordPress Function Assistance with Loop
- Display a list of random terms from custom taxonomy with shortcode
- Change category display name function
- Display link to category over featured image
- How to update an image attachment’s alt text from a custom field when saving a post?
- Help with with my function for wordpress
- Custom Function.PHP Code Not Working on One Site
- Adding new Category does not refresh the backoffice
- ACF Date Form in Custom Admin Field
- how to remove a tag in the_category function
- Reference multiple style sheets, clearing styles for permalink page, custom fields for css
- get_field() with ID in one signal filter not working
- i can’t use wordpress functions in ajax loaded php file
- Echo a String Based On Geolocation? [Woocommerce || ACF]
- Comment function for page
- ACF Filter return value
- Graphic before title – Specific Category
- Hide disclaimer from summary excerpts
- require_once() Causing categories and tag pages on dashboard to not refrsh
- RSS feed including post updates
- different body classes for each category
- update_post_meta not working in function
- How to get tags and categories?
- Change rss title of individual feeds?
- Reversing the order of items in a category rss feed?
- does acf_save_post cause endless loop?
- How to Insert A List of Posts in A Category Written by the Author into the Author Archive
- Disable every rss feed except home feed
- Removing all Category pages with one exception
- Replace category titles inside RSS feed
- Update post meta with wp cron
- Get category of post inside save_post hook