Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
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 Sep 7 '11 at 5:34

1 Answer 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
    )

)
share|improve this answer
1  
So, you're searching for anything containing the word "post"? –  Otto Sep 7 '11 at 17:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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