Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author TIEro

    (@tiero)

    No, it can’t. That’s the first thing on my list for future development: inclusion and exclusion of categories.

    I do have a “jury-rigged” version that I use on a couple of my own sites, where I’ve adjusted the code to exclude a single category, but nothing properly developed yet.

    If you want to exclude a single category and are comfortable messing with code, you can add this to whichever query or queries you desire:

    AND $wpdb->posts.ID NOT IN (SELECT DISTINCT object_id FROM $wpdb->term_relationships
      WHERE $wpdb->term_relationships.term_taxonomy_id = [category number])

    Including only a single category in the expiry check is done by taking out the “NOT” on the first line.

    The main reason I haven’t included categories yet is that the options are so complicated. Including/excluding one or more categories globally is a lot simpler than providing the option for each expiry type, especially when it comes to keeping the options screen layout readable!

    Thread Starter Dani

    (@danicasati)

    Thank you for the code, I’ll try it.
    Maybe, in future version I could test this feature…

    Plugin Author TIEro

    (@tiero)

    No problem. Actually, while I’m here…

    Include a single category:

    AND $wpdb->posts.ID IN (SELECT DISTINCT object_id FROM $wpdb->term_relationships
      WHERE $wpdb->term_relationships.term_taxonomy_id = [category number])

    Exclude multiple categories:

    AND $wpdb->posts.ID NOT IN (SELECT DISTINCT object_id FROM $wpdb->term_relationships
      WHERE $wpdb->term_relationships.term_taxonomy_id IN ([category number], [category number], [category number]))

    Include multiple categories:

    AND $wpdb->posts.ID IN (SELECT DISTINCT object_id FROM $wpdb->term_relationships
      WHERE $wpdb->term_relationships.term_taxonomy_id IN ([category number], [category number], [category number]))

    Not incredibly efficient, any of them, but they’ll work. ??

    Plugin Author TIEro

    (@tiero)

    v1.0.3 being developed right now, with category inclusions and exclusions. Bear with me.

    (The code above does work: I originally posted here that it didn’t, but I’d screwed up the code in the dev version, not the stuff on this page. It’s been a long day. ?? )

    Thread Starter Dani

    (@danicasati)

    No problem, maybe I help you beta-testing next version…

    Plugin Author TIEro

    (@tiero)

    v1.0.3 is now available. I’ve tested it on my own data and sites, but obviously it’s worth keeping an eye on for a day or two.

    Hopefully it will answer all your needs!

    Thread Starter Dani

    (@danicasati)

    Thank you, I’ll try it during next hours.

    Plugin Author TIEro

    (@tiero)

    Marked resolved, due to v1.0.3 functionality. ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Expiration based on category’ is closed to new replies.