Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

The query works if you change "publish" to "draft" or remove the source clause. These are args passed to the WP_Query constructor. I immediately count the results to verify that WP_Query is in fact returning no results. I checked the data in the database and made sure the data is congruent.

Array
(
    [post_type] => post
    [post_status] => Array
        (
            [0] => publish
        )

    [meta_query] => Array
        (
            [view_count_clause] => Array
                (
                    [key] => _viewcount
                    [type] => NUMERIC
                )

            [actual_date_clause] => Array
                (
                    [key] => _actualdate
                )

            [start_date_clause] => Array
                (
                    [key] => _actualdate
                    [value] => 2021-03-23 00-00-00
                    [compare] => >
                )

            [end_date_clause] => Array
                (
                    [key] => _actualdate
                    [value] => 2021-03-24 00-00-00
                    [compare] => <
                )

            [color_clause] => Array
                (
                    [key] => _color
                    [type] => NUMERIC
                    [compare] => IN
                    [value] => Array
                        (
                            [0] => 4
                        )

                )

            [source_clause] => Array
                (
                    [key] => _sourcename
                    [value] => AHA
                    [compare] => =
                )

        )

    [orderby] => Array
        (
            [actual_date_clause] => DESC
        )

)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
204 views
Welcome To Ask or Share your Answers For Others

1 Answer

Related question here.... How to avoid the limit on the number of AND conditions for custom field (meta value) queries in WordPress get_posts()?

Problem:

WP_Query limits meta query clauses to five meta clauses. If you have 6 meta query clauses, you will get no results.

Solution 1:

Write your own SQL query. Example provided by the related question.

Solution 2:

Remove excess meta queries beyond the 5 meta query limit for WP_Query and manually filter results. Choice of meta queries to be removed should be based on whatever would result in the smallest data set.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...