function &get_categories( $args = '' ) {}

Retrieve list of category objects.
If you change the type to ‘link’ in the arguments, then the link categories will be returned instead. Also all categories will be updated to be backwards compatible with pre-2.3 plugins and themes.


  • string|array $args: Optional. Change the defaults retrieving categories.

Return values

returns:List of categories.

Defined filters

  • get_categories_taxonomy
    apply_filters( 'get_categories_taxonomy', $args['taxonomy'], $args )

Source code

function &get_categories( $args = '' ) {

	$defaults = array( 'taxonomy' => 'category' );

	$args = wp_parse_args( $args, $defaults );

	$taxonomy = apply_filters( 'get_categories_taxonomy', $args['taxonomy'], $args );

	// Back compat

	if ( isset($args['type']) && 'link' == $args['type'] ) {

		_deprecated_argument( __FUNCTION__, '3.0', '' );

		$taxonomy = $args['taxonomy'] = 'link_category';


	$categories = (array) get_terms( $taxonomy, $args );

	foreach ( array_keys( $categories ) as $k )

		_make_cat_compat( $categories[$k] );

	return $categories;



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: