0

This is the array for my arguments for the WP_Query.

Array
(
    [showposts] => 4
    [paged] => 1
    [post_type] => post
    [post_content] => tree
    [category__and] => Array
        (
            [0] => 6
            [1] => 15
            [2] => 28
        )

)

I want to return the posts where they are in the categories 6, 15, 28 and where the post_content has the word tree.

My problem is that I'm returning several duplicated results for the posts that have the word tree in it. Ideally I would like to return one.

anyone have any idea how I can fix or improve this?

1
  • 1
    Where are you getting post_content from? To the best of my knowledge, that's not a valid thing to pass to a WP_Query. That isn't how the search works. Searching uses the "s" parameter, and it searches both post_title and post_content. As far as I know, setting the post_content in the query to "tree" or anything else would do nothing whatsoever.
    – Otto
    Commented Sep 7, 2011 at 5:34

1 Answer 1

1

I found the issue, I shouldn't have been trying to filter on post_content, but rather 's'

e.g.

Array
(
[showposts] => 4
[paged] => 1
[s] => post
[post_content] => tree
[category__and] => Array
    (
        [0] => 6
        [1] => 15
        [2] => 28
    )

)
1
  • 1
    So, you're searching for anything containing the word "post"?
    – Otto
    Commented Sep 7, 2011 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.