WordPress.org

Ready to get started?Download WordPress

Forums

Clean Archives Reloaded
[resolved] Possible to exclude category in get_results (5 posts)

  1. nwonderland
    Member
    Posted 3 years ago #

    Hi Alex,

    Is it possible to modify the get_results function to exclude a category? I noticed that in older versions, you used get_posts, but now I'm not sure how to do it for get_results. Thanks!

  2. Alex Mills (Viper007Bond)
    Moderator
    Plugin Author

    Posted 3 years ago #

    It's easier to just replace that with:

    $rawposts = get_posts( ... );

    Use the args from the old version.

  3. nwonderland
    Member
    Posted 3 years ago #

    Just reinstalled an older version and made the change. It works! Thanks!

  4. matius
    Member
    Posted 3 years ago #

    Hey, what goes in . . . for those of us who need a clue ;)

  5. Alex Mills (Viper007Bond)
    Moderator
    Plugin Author

    Posted 3 years ago #

    Replace the line in the current plugin that has $rawposts = $wpdb->... with something like this:

    $rawposts = get_posts( 'numberposts=-1&cat=-123' );

    It'll use more memory but should do the trick.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic