Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7681869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:26:24+00:00 2026-05-31T18:26:24+00:00

$cats= get_categories(array( ‘order’ => ‘ASC’, ‘orderby’ => ‘id’, ‘hierarchical’ => 0, ‘hide_empty’ => 0,

  • 0
$cats=  get_categories(array(
    'order'                    => 'ASC',
    'orderby'                  => 'id',

    'hierarchical'             => 0,
    'hide_empty'               => 0,
    'taxonomy'                 => 'edu_year'
));

I would like to produce a variable that contains an array of the IDs of the values retrieved from the get_categories function.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T18:26:25+00:00Added an answer on May 31, 2026 at 6:26 pm

    Based on the documentation it returns:

    $category->term_id
    $category->name
    $category->slug
    $category->term_group
    $category->term_taxonomy_id
    $category->taxonomy
    $category->description
    $category->parent
    $category->count
    $category->cat_ID
    $category->category_count
    $category->category_description
    $category->cat_name
    $category->category_nicename
    $category->category_parent
    

    So:

    $output_categories = array();
    $categories=get_categories($args);
      foreach($categories as $category) { 
         $output_categories[$category->cat_ID] = $category->name;
    }
    

    Then $output_categories is exactly what you need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are about 70 categories in Drupal 7 with taxonomy. I would like to
I have some codes like this: cats = Category.objects.filter(is_featured=True) for cat in cats: entries
i have this recursive code <ul> <% sql=SELECT * FROM cats ORDER BY orderid
My website file structure currently looks like this: marketplace.php cats.php On marketplace.php I have
if I have something like this: @{ var cats = GetCategories(); var selectList =
What I'd like ti achieve is that when I call $obj->CAT[15]; the $obj would
For the below array i get a smooth curve. data.addColumn('string', 'x'); data.addColumn('number', 'Cats'); data.addColumn('number',
How to get from this dict: cats = [ {'parent_id': False, 'id': 1, 'title':
I have this code in my controller: @cats = DirCat.all And this in a
I want to make a query to list cats that took longer than average

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.