get_categories — returns array of categories or false



Return Values

Array with categories or false if the categories are not found.


//get main categories for the content
$categories = get_categories('rel_type=content&parent_id=0&orderby=position asc');

//you can use the categories functuonality to for your custom data with the rel_type parameter
$modules_categories = get_categories('rel_type=modules&parent_id=0');


You can pass parameters as string or as array.

idthe id of the categoryget_categories('id=3');
parent_idthe id of the parent categoryget_categories('parent_id=0');
rel_typethe category relation to other db tableget_categories('rel_type=content');
rel_idthe item from the related db tableget_categories('rel_type=content&rel_id=5'); gets categories for the content with id 5
created_byget by author idget_categories('created_by=1');
created_atthe date of creationstrtotime compatible date
updated_atthe date of last editstrtotime compatible date
titleTitle of the category
contentThe html content saved in the database
descriptionDescription used for the content list
positionThe order position
users_can_create_contentflag if users can add content in this category"n" or "y"
The documentation is under development. Help us by editing this page.