Wordpress - Get current category name and / or ID


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. //AKTUELLE Post-KATEGORIE-ID ermitteln
  3. foreach((get_the_category()) as $category)
  4. {
  5. $postcat= $category->cat_ID;
  6. $catname =$category->cat_name;
  7. //echo $postcat;
  8. }
  9. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.