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?
- Display random categories on the front page (Finding and Editing Theme Functions)
- Advantages and disadvantages of using automatic-feed-links
- functions.php inject inline css
- How to add classes to images based on their categories?
- 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?
- How to set child post categories to parent post categories when updating parent post?
- Assign category using custom field?
- How To Get WordPress Categories Link List?
- RSS Feed has no styles in chrome – function to add one?
- 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
- How do I edit wp_head and/or functions.php to remove rss-feed which isnt used and dont validate?
- Attach parent category template to all subcategories
- Best practices for multiple Custom Feeds functions
- 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()
- Display Password Protected external RSS in wordpress template
- Custom HTML in specific category single page and its descendant categories
- Possible to display shortcode based on the category?
- Unset Category if other Category is unset during post transition
- Get the link for RSS item to display in feed
- Retrieve tags data in post body
- Select pages by category
- Run function when WordPress new multisite is created or ACF field is updated
- Having issues with a foreach inside of a shortcode with ACF gallery
- 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
- Ordering posts by publish date not working?
- How to remove style attribute in WordPress RSS output?
- Get Current Post ID in functions php, meta query filter
- Categories as main menu items and subcategories as nested lists
- Run wp_kses_decode_entities on atom feed?
- Redirect to another page using contact form 7? [closed]
- Get category URL for current post
- Need help “sanitizing” a custom function that pulls category slug into body class
- allow only one post in specific category
- ACF not showing
- How to obtain the recent posts without their content in an efficient way?
- Setting a default text for excerpts of a particular category
- 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?
- How to retrieve the values of a sub-field in the first and last row of an (ACF) repeater inside function?
- Return category name with & Ampersand doesnt work
- Add php code to wp_print_scripts?
- Can set_post_thumbnail be used to remove a thumbnail?
- issue with if/elseif in_array inside foreach loop display only one post
- Randomizing wp_tag_cloud() in child theme
- How replace individual elements in the RSS feed with a single string
- add_filter to specific WooCommerce Category
- 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
- Specify multiple categories for custom post template – FATAL ERROR
- “All posts” in the category widget
- Get Attachment Category Name
- Using two loops in one WordPress template
- How do I place a function in a standalone page?
- Insert a field with PREG_REPLACE – strange behaviour
- Perform function on publish AND save (not just save)
- Aspx/Rss feed – failed to open stream: Redirection limit reached
- 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
- How to show ACF value under post/page title in wp-admin
- How to display an image before title text in menu items
- Display a list of random terms from custom taxonomy with shortcode
- Change category display name function
- Filter works on last selection but no others
- Display link to category over featured image
- How to update an image attachment’s alt text from a custom field when saving a post?
- Remove the ‘category’ url for one category type