Try this :
// This converts the WP_Term Object to array.
$catlist = json_decode(json_encode($catlist),true);
$category_id = array_column($catlist, 'cat_ID');
print_r($category_id);
Related Posts:
- Get categories names as an array to use it in theme settings
- How to get the last category name of a child category?
- Output category list inside array
- How To Pass Array To get_the_category_by_ID() and Get An Array Back?
- Finding and removing duplicates within WP Arrays
- Using multiple variables to assign categories to an array
- How to filter specific element of an array in wordpress/php?
- wp_get_archive for category returning different URLs on different but similar sites
- !in_array doesnt recognize category
- Getting key value of WP_Term object in wordpress
- Counting number of posts in a category and its sub categories and displaying result using shortcode
- How to Remove Parents Category Permalink from Posts
- Looking to exclude blog posts from category Previous/Next buttons
- Looping through WP_Post Object
- Using a javascript file to access a get posts array
- Generate an array of parent/child page IDs, based on parent page name
- How do I output a database option that is an array into a get_posts array?
- Listing and displaying WooCommerce Shipping Zones in the frontend? [closed]
- Check if term object is in array
- How to exclude specific category from the get_the_category(); array
- combine Code 1 with Code 2
- Using a variable in is_page(array())
- Remove duplicates – array_unique()
- get post based on category chosen in drop down – The ajax method
- Recent posts with featured image or fallback image with permalink
- Storing Array from returned database query and using the array in a new query
- Proper syntax or method for keeping url in modified isotope / category links
- get_the_tags() not iterating through for/while loop, but will with foreach
- selected option if current category is the value
- get_template_part based upon post’s category
- Exclude posts based on meta value
- Alert Bar section within WP loop is displaying even though there are no posts
- Different post styles depending on category
- Advanced Custom Fields – display label and value only if value entered
- Define specific category name in PHP
- Category title output before opening title tag
- wp_force_remove_style’ not found
- Include Parent Term in wp_list_categories
- How can I access string value in an array?
- Get all categories post is not in
- Error while setting role
- Rewrite with pagination /foo/page/2/ to posts of a given category, page 2
- How to say if meta_value is greater than 0 in an array?
- Loop over Array and get the distinct ids
- Remove empty terms from array, sort alphabetically, update back to repeating field
- Only show first image in foreach loop
- How to get category name or ID by post?
- How can I get all values from my array in a loop in php? [closed]
- Get all posts as an array ID => Name
- Post not populating for custom post type based on category selection
- Filter by field with array value in ACF on WP REST API
- Listing titles and custom fields of entries within subcategories
- random display categories – change url
- Do not duplicate posts with multiple categories in multiple loops
- Removing sidebar on category pages
- Separate array output into a
- add the value of a variable returned in a while loop [closed]
- Update value of a associative array with update_post_meta
- Adding wp_list_categories to a specific div that was appended using jQuery
- MySQL Query Returns Array () In Shortcode
- Counting number of posts in multiple (sub)categories using shortcode
- Convert a column of a table containing an Array as response in HTML
- How do I edit the terms output args or array data?
- Change category thumbnail size
- Create an array with all the links of the years’ archive (of a custom post type)
- Redux option doensn’t seem when include from functions.php
- admin panel – How to remove “delete” button from category editing page
- Get parent category name when only child category is applied to a product
- Multiple Tag Filtering
- How to insert multiple rows and columns in database using array
- Display one random image from Media Library
- How does Permalink work with the AMP plugin after Removing Parent Permalink Catalog from Posts
- Polylang and template files
- Notice: Undefined variable
- Show subcategory name selected in specific category woocoommerce
- Exclude category and post from loop in custom category.php
- get_category_parents to array
- Exclude a category slug on pagination
- Custom content using in_category
- PHP drop down menu for my get_category child of
- How can i iterate through this shortcode array?
- Need Quick Help With Product Category Page
- Need to adjust condition to say if I’m pulling categories from a post, to pull only the first one
- Rearrange get_categories array compared to another array
- Non-array argument in array_merge()-function [closed]
- Search in particular category in wordpress
- Query seems to be duplicated
- Top menu disapears in Category Pages when filtering using ACF
- Remove the_content From Loop
- Category List in Theme Options Page
- Showing all post from all post type in admin backstage
- Use php array outside his function
- Product Category Page in Full Width
- Retrieve Array from within Array [closed]
- Display all categories (with link) of custom post type – WordPress
- save array of objects with update_option
- Hide child of parent categories already hidden with “get_terms_args” – Woocommerce
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
- Get category name of current post (CPT UI)
- Replace block content with an array