WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] how to echo category id outside of the loop

[Resolved] how to echo category id outside of the loop

  • hi all,

    i want to display the category id of the current category outside of the loop. i tried it with <?php $thecatid = get_cat_ID( $cat_name ) ; echo $thecatid; ?> but it only returns me a ‘0’.
    i found a working solution in the forums get_cat_id( single_cat_title("",false) ) but i’m not sure if this is really a “clean” solution.

    thanks, martin

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] how to echo category id outside of the loop’ is closed to new replies.
Skip to toolbar