<?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
. but when I turn on SEO
the array is empty
how can I get the category id with SEO friendly urls
Use this function to get current cateogry in wp :
}
Just found for you also try this,
Paste in your
functions.php
or use in your pluginWhen url is like
http://example.com/category_name