wordpress: cant get category id when SEO URL is turned on

Posted by John K on Stack Overflow See other posts from Stack Overflow or by John K
Published on 2012-07-06T09:04:37Z Indexed on 2012/07/06 9:15 UTC
Read the original article Hit count: 293

<?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

© Stack Overflow or respective owner

Related posts about php

Related posts about Wordpress