Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. global $post;
  2. $postcat = get_the_category( $post->ID );
  3. $postcatjson = json_encode( $postcat );
  4.  
  5. array(1) { [0]=> object(WP_Term)#882 (16) { ["term_id"]=> int(4) ["name"]=> string(6) "Second" ["slug"]=> string(6) "second" ["term_group"]=> int(0) ["term_taxonomy_id"]=> int(4) ["taxonomy"]=> string(8) "category" ["description"]=> string(0) "" ["parent"]=> int(0) ["count"]=> int(1) ["filter"]=> string(3) "raw" ["cat_ID"]=> int(4) ["category_count"]=> int(1) ["category_description"]=> string(0) "" ["cat_name"]=> string(6) "Second" ["category_nicename"]=> string(6) "second" ["category_parent"]=> int(0) } }
  6.  
  7. $postcatjson = json_encode( $postcat );
  8.  
  9. [{"term_id":4,"name":"Second","slug":"second","term_group":0,"term_taxonomy_id":4,"taxonomy":"category","description":"","parent":0,"count":1,"filter":"raw","cat_ID":4,"category_count":1,"category_description":"","cat_name":"Second","category_nicename":"second","category_parent":0}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement