• Resolved c-bass

    (@c-bass)


    how can i exclude a category in
    $my_query = new WP_Query('category_name=neuigkeiten&showposts=1'); ???

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Instead of category_name, just use cat. You can exclude category #4 like so: cat=-4

    Thread Starter c-bass

    (@c-bass)

    thhhhhhhhhhhhhhhhhaaaanx

    But this excludes posts that belong to a category. What if I have a post that belongs to another “main” category but also belongs to the excluded category as a secondary category.

    Is there any way to use “cat” as a secondary category only?

    Thanks.

    @ipruthi:

    Is there any way to use “cat” as a secondary category only?

    I am trying to do something similar with an algorithm I thought would be able to be flexible enough to allow arbitrary exclusions. It used to work in 2.5.1 but seems broken in 2.6.

    I posted a help topic about this but have yet to receive feedback. Maybe the answer to my problem will also help you?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to exclude category in WP_Query();’ is closed to new replies.