//get_queried_object_id if ( is_category() ) { $catid = get_queried_object_id(); } elseif ( is_single() ) { $cats = wp_get_post_terms( get_queried_object_id(), 'category', array( 'fields' => 'ids' ) ); // category object $catid = $cats[0]; } //ref: https://wordpress.stackexchange.com/users/31545/pieter-goosen
Boucler en dehors de la boucle
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.