I assume you want the field for the current category archive, not the category of the post inside the loop? Try get_queried_object_id()
instead of the_category_ID( $echo )
.
In single.php
, you just need a slightly different iteration of your original attempt:
if ( $terms = get_the_category() )
the_field( 'bgcolor', 'category_' . $terms[0]->term_id );
Related Posts:
- get_field not displaying my custom field value
- How to query categories with Advanced Custom Fields?
- How can i add service category here? [duplicate]
- How can I add different custom fields for each category in the same post?
- ACF plugin categories bug in WordPress 3.9
- Order get_terms() By Custom Field
- Add extra fields to Add New Category page
- Need help adding custom field to category
- adding custom fields to next and previous post link
- Custom query with category exclusion and post-meta “whitelist”
- Sort category page with custom field
- Create a full width responsive header image per page
- Advanced Custom Fields: Using category as a rule, before publishing new post?
- Return category slug / title from category ID
- advanced custom field Show field in special categry page [closed]
- Filter out posts before display category count
- How to put enctype=”multipart/form-data” in categories form?
- Add custom taxonomy under the category title
- Sorting posts by season
- How to change post featured image using a custom field of category?
- How to loop only categories without posts (+ show category featured image with acf) [closed]
- ACF: Display category name using taxonomy field
- How to call custom category field data in theme?
- query in category.php repeats itself
- need to add custom field in more products
- Retrieving category’s color with get_term_meta
- How to change a post category when the ACF datepicker Field is today
- Assign category from custom field on post creation and update
- Listing Texts of Which Custom Field is Null
- How to “group” (categorize) the Pages together?
- ACF add custom fields to categories and display
- Redirect to another page using contact form 7? [closed]
- How to add custom color fields to the category edit page?
- Notice: Trying to get property of non-object in : custom fields category
- echo get_post_meta of all post in a category to fill up a select field
- How to display a value inside a post with a specified category from a category custom field? [closed]
- “Virtual category page” based on a custom field filter
- Query (built in) Categories and Advanced Custom Fields?
- Displaying a custom field in Category Archives
- Assign a custom post to a custom taxonomy based on custom field value
- Custom Fields Value As Taxonomy
- Update custom category fields front-end
- What is the best way to add an advanced / intermediate / beginner tag to a post
- Show posts from category specified using a custom field
- Adding tinymce to Custom Field boxes on Category edit page
- Sort categories by custom field in WordPress admin
- How to set acf color field as background color to product category
- Modifying category order
- Displaying data from custom fields on a specific category page
- How to display custom fields as table in Woocommerce
- How to create a category loop on my blog (ACF Plugin)
- How to modify custom category field from front end?
- ACF Custom field not showing in Timber Taxonomy page
- Ajax Category add doesn’t update the list table custom column
- In ACF, how to show custom category selection tab upon selecting a main category
- How to Manage and link certain custom taxonomy?
- Custom field picture instead of post thumbnail on category page
- How to loop through a custom field for each post, & display?
- $args Orderby The number
- My Query is getting the wrong data
- Formating content in category.php
- Logic for Nearby places with post and categories
- Sort categories by meta value
- How to structure Multisite sites into categories?
- Custom Fields to Category edit page, then displaying them in a template correctly
- How do I add and display a custom image field to a category? [duplicate]
- How to use acf field value to order category?
- Converting Categories (with ACF fields) to custom taxonomies
- How Do I Add HTML Support to the Additional Category Description Field?
- How to link ACF relationship field to the new Query block in Full Site Editing
- Add custom text in second paragraph of posts in specific category
- WP 3.9 TinyMCE no longer loads on category description editor
- Change Gutenberg category checkboxes to radios
- Matching Serialized Arrays with meta_query
- Why is per_page not working with categories in WP API?
- In the tag archive – display count of posts for each category they belong to
- anything like add_meta_box for categories?
- Hide uncategorized products from the shop page
- weekly archive for custom category
- .htaccess too many redirects based on category slug
- wp_list_categories depth and number
- How to redefine the sorting of product categories by menu_order?
- Restrict author to create subcategory in a selected category
- How to restrict user to choose 1 category for a post
- How do order product categories – on a parent category page – in Woocommerce?
- Display only subcategories of a category and not sub-subcategories
- Show post categories
- Exclude categories by ID
- How to differentiate the homepage structure from the category page structure in WordPress template?
- Custom sidebar isn’t showing up on sub-category posts
- How do I change the functionality of an image slider which is part of ACF?
- Function add class to second menu specific items if the page has a certain category
- Meta Box: display single image on an archive-template
- Filtered post assigned to categories
- Transfering static site to wordpress and retaining category by month paginations
- Bringing Ajax Loading Feature on Category Pages
- Dynamically Adding Category Specific Content To Specific Category & Subcategory Pages
- Structure with category setting
- Do not show all post from all categories, just show posts from category in current loop
- How to prevent page re-sizing for mobile browsers [closed]