get_all_category_ids

函式
get_all_category_ids ( No parameters )
返回值
  • (int[]) List of all of the category IDs.
相關
  • get_terms()
定義位置
相關方法
get_the_category_listget_all_page_idsget_categoriesget_category_linkget_the_category_by_id
引入
2.0.0
棄用
4.0.0

get_all_category_ids: 這個函式返回一個所有類別ID的陣列。

檢索所有類別的ID。

function get_all_category_ids() {
	_deprecated_function( __FUNCTION__, '4.0.0', 'get_terms()' );

	$cat_ids = get_terms(
		array(
			'taxonomy' => 'category',
			'fields'   => 'ids',
			'get'      => 'all',
		)
	);

	return $cat_ids;
}

常見問題

FAQs
檢視更多 >