Get all category ids in WordPress [Array]

Choose either one of these options to Get all category ids in WordPress as an Array Get all category ids, Option 1 $output_categories = array(); $categories=get_categories($args); foreach($categories as $category) { $output_categories[] = $category->cat_ID; } Get all category ids, Option 2 $categories_ids = get_terms( array( 'category' ), // Taxonomies array( 'fields' => 'ids' ) // Fields … Continued