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

  • SEARCH
  • Home
  • 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 6580801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:04:22+00:00 2026-05-25T16:04:22+00:00

I am working with WordPress and since I don’t believe it is possible to

  • 0

I am working with WordPress and since I don’t believe it is possible to sort object details, I was wondering how to go about converting my Object to an Array, so that sorting can be possible.

Any help or guidance would be greatly appreciated.

I am using the WP function get_categories();

The complete content of $category is:

$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
  • 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-25T16:04:23+00:00Added an answer on May 25, 2026 at 4:04 pm

    If the object is not too complex (in terms of nesting) you can cast the class to an array:

    $example = new StdClass();
    $example->foo = 'bar';
    
    var_dump((array) $example);
    

    outputs:

    array(1) { ["foo"]=> string(3) "bar" } 
    

    However this will only convert the base level. If you have nested objects such as

    $example = new StdClass();
    $example->foo = 'bar';
    $example->bar = new StdClass();
    $example->bar->blah = 'some value';
    
    var_dump((array) $example);
    

    Then only the base object will be cast to an array.

    array(2) { 
      ["foo"]=> string(3) "bar" 
      ["bar"]=> object(stdClass)#2 (1) { 
        ["blah"]=> string(10) "some value" 
      }
    } 
    

    In order to go deeper, you would have to use recursion. There is a good example of an object to array conversion here.

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

Sidebar

Related Questions

I'm working on a wordpress site, with a blog post that ends like: http://www.blog.com/?p=2
I'm working on a WordPress that will allow the site administrator to switch between
I developed a plugin with Settings link that was working fine in WordPress 2.7.
I starting working with WordPress as a CMS, now that the V3 makes it
Im working with wordpress and this function im using returns this or something that
WP_Query('orderby=post_date') is not working with wordpress. how do I sort my posts in descending
I just got this wordpress theme: http://meezio.pixelworkshop.fr/ Very nice, the problem is that since
I just saw that the newer wordpress (newer meaning since the last time I
Well I am working with wordpress and I'm trying to sort some posts by
I'm working on a Wordpress theme that has a Jquery animated contact form in

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.