• Due to the update we noticed problems with the old ‘get_mostpopular()’ template tag. Based on the documentation we changed to the ‘wpp_get_mostpopular()’ template tag. Everything seems to be working correctly except the ability to exclude certain categories. The code we are using is:

    <?php wpp_get_mostpopular("cat=-88&order_by=views&range=all&limit=5&stats_comments=0&post_type=post"); ?>

    Unfortunately, the posts in category 88 are still showing. Are we doing something incorrectly?

    https://www.ads-software.com/extend/plugins/wordpress-popular-posts/

Viewing 8 replies - 1 through 8 (of 8 total)
  • The same error at my. I restored the previous version and got it working again! But, the new version needs a bit more touch up!

    Plugin Author Hector Cabrera

    (@hcabrera)

    Hi guys,

    Will look into this. Thanks for reporting.

    Thread Starter Jonathan Goldford

    (@jg-visual)

    It took me some time, but I tracked down the problem here. The issue is on line 1460 of wordpress-popular-posts.php. The function ctype_digit returns false if it finds any minus signs in the string, so trying to exclude any categories will just return an empty string. I replaced line 1460 from:

    'cat' => (ctype_digit(str_replace(",", "", $cat)) && !empty($cat)) ? $cat : '',

    to:

    'cat' => (preg_match('/^[0-9-]*$/', str_replace(",", "", $cat)) && !empty($cat)) ? $cat : '',

    and that seemed to fix the problem.

    Hector, if you’d like I can send over a diff file, but I figure the change is straightforward enough.

    jitujazz123, I hope that’s helpful.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Good catch, Jonathan. Just updated the plugin and the fix should be available within the next 30 minutes. Simply redownload the plugin and let me know if you encounter any further issues.

    Thread Starter Jonathan Goldford

    (@jg-visual)

    Thanks for taking care of it so quickly Hector. I like the adjustment you made too, going with |[^0-9,-]| in a replace instead of checking if they exist. Much cleaner.

    Thread Starter Jonathan Goldford

    (@jg-visual)

    I went to update the plugin to the newest version and it says that we’re already using the newest version. Did you add those changes without tagging a new version?

    Plugin Author Hector Cabrera

    (@hcabrera)

    Yup, since it was just a single fix I didn’t want to tag it as a new version.

    Thread Starter Jonathan Goldford

    (@jg-visual)

    Thanks for the update and for taking care of everything so quickly.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: WordPress Popular Posts] New Template Tag Not Removing Category’ is closed to new replies.