wordpress: cant get category id when SEO URL is turned on
- by John K
<?php
/*
Plugin Name: Members
*/
function myFilter2($query)
{
if ($query->is_category)
{
$currently_listing_categories = $query->query_vars['category__in'];
print_r($currently_listing_categories);
}
}
add_filter('pre_get_posts','myFilter2');
?>
This plugin display the category ids when the url is not SEO friendly
http://domain.com/wplab/wpla4/?cat=4
. but when I turn on SEO
http://domain.com/wplab/wpla4/category/members/
the array is empty
how can I get the category id with SEO friendly urls