the_category

Display the category list for the post.

Description

the_category( (string) $separator = '', (string) $parents = '', (bool) $post_id = false ); 

Parameters (3)

0. $separator — Optional. (string) => ''
Optional, default is empty string. Separator for between the categories.
1. $parents — Optional. (string) => ''
How to display the parents.
2. $post_id — Optional. (bool) => false
Post ID to retrieve categories.

Usage

  1. if ( !function_exists( 'the_category' ) ) { 
  2. require_once ABSPATH . WPINC . '/category-template.php'; 
  3.  
  4. // Optional, default is empty string. Separator for between the categories. 
  5. $separator = ''; 
  6.  
  7. // Optional. How to display the parents. 
  8. $parents = ''; 
  9.  
  10. // Optional. Post ID to retrieve categories. 
  11. $post_id = false; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = the_category($separator, $parents, $post_id); 
  15.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/category-template.php  
  1. function the_category( $separator = '', $parents='', $post_id = false ) { 
  2. echo get_the_category_list( $separator, $parents, $post_id );