Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_the_category [ WordPress Function ]

get_the_category ( $id = false )
Parameters:
  • (int) $id Optional, default to current post ID. The post ID.
Uses:
  • $post
Returns:
  • (array)
Defined at:



Retrieve post categories.

Source


<?php
function get_the_category$id false ) {
    
$categories get_the_terms$id'category' );
    if ( ! 
$categories )
        
$categories = array();

    
$categories array_values$categories );

    foreach ( 
array_keys$categories ) as $key ) {
        
_make_cat_compat$categories[$key] );
    }

    
// Filter name is plural because we return alot of categories (possibly more than #13237) not just one
    
return apply_filters'get_the_categories'$categories );
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics