[WORDPRESS] [Funzione] get_the_category()

get_the_category() (funzione WordPress) restituisce, sotto forma di array, le categorie di un post.

tips&tricks

Sintassi

get_the_category($post_id)
parametro descrizione
$post_id L’ID del post. In mancanza, l’attuale.

Esempi

print_r(get_the_category(1));
/* RISULTATO
Array
(
    [0] => WP_Term Object
        (
            [term_id] => 1
            [name] => Uncategorized
            [slug] => uncategorized
            [term_group] => 0
            [term_taxonomy_id] => 1
            [taxonomy] => category
            [description] => 
            [parent] => 0
            [count] => 1
            [filter] => raw
            [cat_ID] => 1
            [category_count] => 1
            [category_description] => 
            [cat_name] => Uncategorized
            [category_nicename] => uncategorized
            [category_parent] => 0
        )

)
*/

Contenuti correlati

  • CSS
  • HTML
  • JavaScript
  • jQuery
  • PHP
  • SQL
  • WORDPRESS

Fonti esterne

funzioni wordpress, wordpress

Related Articles

0 Comment

Rispondi