Support » Plugin: WordPress Popular Posts » Exclude Category not working

  • Resolved billcommexis

    (@billcommexis)


    I’ve been using this plugin for a while now and it has been working great. Recently a client had a request to have the ability to exclude certain posts from the list. I have edited the code to exclude a certain category, but posts with that category are still showing. If I change the code to only show posts with the new category, it works fine, but it will not exclude the category. Here is my code:

    <?php
                        $args = array(
                            'limit' => 5,
                            'range' => 'monthly',
                            'order_by' => 'views',
                            'post_type' => 'post',
                            'cat' => '-2933'
                        );
    
                        wpp_get_mostpopular( $args );
                        ?>

    Any help with this would be appreciated.

Viewing 4 replies - 16 through 19 (of 19 total)
  • noonecares

    (@thedeanamsterdam)

    i think i fixed it by inserting the number of the category instead of the whole category name, but how will i know if u fix a solution for this? and not this cheat?
    thank you so much!

    Plugin Author Héctor Cabrera

    (@hcabrera)

    i think i fixed it by inserting the number of the category instead of the whole category name…

    The field is called “Category ID(s)” for a reason, of course you need to pass IDs instead of names 😛

    how will i know if u fix a solution for this?

    I don’t think I’ll change the way the category filter works. At least not at the moment. As I mentioned earlier, the plugin tries to follow / respect the standard behavior of WordPress. If WordPress decides pages should have categories in the future, then WPP will follow. Or I might just add a filter hook to allow for this kind of thing, I don’t know.

    For the time being you should check WPP’s changelog regularly to see if there’s any change that might break your custom modifications / workarounds.

    noonecares

    (@thedeanamsterdam)

    hey man i fixed it by using the category number instead of the category name! so now i can include pages with the same category.

    noonecares

    (@thedeanamsterdam)

    thnx for all the help you are the man

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Exclude Category not working’ is closed to new replies.