Use this code.
$categories = get_terms('toc_category');
$sorted_cats = array();
foreach($categories as $cat){
$ordr = get_field('order', 'toc_category_'.$cat->term_id);
$sorted_cats[$ordr] = $cat->name;
}
krsort($sorted_cats);
return $sorted_cats;
Related Posts:
- get_field not displaying my custom field value
- Advanced Custom Fields: Using category as a rule, before publishing new post?
- advanced custom field Show field in special categry page [closed]
- Sorting posts by season
- How to loop only categories without posts (+ show category featured image with acf) [closed]
- ACF: Display category name using taxonomy field
- Assign category from custom field on post creation and update
- ACF add custom fields to categories and display
- How to query categories with Advanced Custom Fields?
- How to display a value inside a post with a specified category from a category custom field? [closed]
- Query (built in) Categories and Advanced Custom Fields?
- ACF no print data [closed]
- How can i add service category here? [duplicate]
- How to set acf color field as background color to product category
- How can I add different custom fields for each category in the same post?
- How to create a category loop on my blog (ACF Plugin)
- In ACF, how to show custom category selection tab upon selecting a main category
- ACF plugin categories bug in WordPress 3.9
- My Query is getting the wrong data
- How to link ACF relationship field to the new Query block in Full Site Editing
- Display All Products by Category with WooCommerce
- Add a URL prefix to permalinks of one category of posts only
- Woocommerce get category image full size
- Add forward slash on categories url (serve one version of a url)
- Elegant way to add parent categories?
- Alphabetical Index Page
- adding custom fields to next and previous post link
- Categories Listing with “selected” category highlighted
- Assign parent category to all posts that are already assigned to child category
- Using same slug name for a page and category
- List Categories of the Parent Category of the Current Category
- Link each category to last post
- Auto add pages to category menu
- Getting WordPress custom taxonomy/category?
- Get term by slug in Gutenberg
- How to get post category title within the loop?
- If category is in parent category?
- Hide posts of a certain category unless logged in
- Show only first children level of current category?
- Problem displaying one post from each category
- How do I automatically put categories and their descriptions on a WP Page?
- Taxonomy filter all children
- RSS/XML of all Categories and/or Tags
- URL path for wordpress categories
- Limit a meta box to a specific category
- get_posts and multiple categories
- How do I get rid of “category” from my URL structure?
- Only one post is showing on category page, why?
- Have different permalinks based on category
- How do I output all category with custom field?
- Add /category/ to an author archive page
- Remove subcategory and category with some rules from permalink
- category pagination got broken suddenly
- How to remove specific categories from posts?
- how to get full category path including parent and subcategories
- WordPress get from single.php back to the right category page
- Categories are not listing their respective products
- Include WooCommerce product to all child categories
- Two columns in homepage each with one category
- Pagination on category.php and tag.php not working
- WordPress link to post links to category (loop)
- How do I attach a page to a category similar to how we attach media to a post?
- Display all product tags associated with a specific product category
- How replace individual elements in the RSS feed with a single string
- Category url generate 404 error
- Style a category from category list
- Adding a page summary to a specific page
- Adding a block with query in homepage
- Add a category on all archive category pages
- what file I need to create to work date archive links?
- multiple values in an array for category__and does not work with WP_Query
- Assigning certain pages or posts to use the template of the parent page or category
- I need advice on how to structure the categories according to the layout i have
- How to get posts using category slug in ClassiPress?
- Assign author to category and not only posts
- Add properties to term object
- How to fetch common posts from two feeds?
- Display all Categories
- How to target all woocommerce categories that don’t have any subcategories in them?
- How to add all subcategories as submenu in WordPress menu
- echo $category[0]-> cat_name; shows only one category name
- Category pages resolving with and without category prefix
- Is there a way to allow users to customize their feed view?
- Number of categories slowing down the site
- Change post category within pre_get_posts
- Subcategory Page 404ing
- displaying one category on one page
- Ajax Category add doesn’t update the list table custom column
- Question About Messing With Category Pages and Descriptions
- how to get postmeta info based on multiple categories?
- List Terms by category
- Add advertising box to a specific category page
- How do you add Author and date Published on Category Pages?
- Twenty Eleven Theme [duplicate]
- display certain category on custom template page
- List products from current category
- How to delete categories in WordPress
- Extract post category except one category
- Taxonomy page wpml dropdown not working
- How to get all Existing Categories from a Custom Post Type