Function: get_categories

get_categories( string | array $args )

Retrieve list of category objects.

Shortcut: gc

You can use above key combination to trigger the associated snippet for this function in the WordPress Snippets for Visual Studio Code extension. You can also use this shortcut to search for this function on this website.

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 backward compatible with pre-2.3 plugins and themes.


Name Type(s) Default Value Description
$args string | array ''

{ Optional. Arguments to retrieve categories. See get_terms() for additional options.

@type string $taxonomy Taxonomy to retrieve terms for. In this case, default 'category'.




List of categories.

WordPress Developer Newsletter

Stay informed of new chapter releases, important WordPress API updates and more.