[wp-hackers] Advanced Taxonomy Query Question

Haluk Karamete halukkaramete at gmail.com
Wed May 14 07:22:57 UTC 2014


In the following sample Advanced Tax. Query, I have 2 questions.

1. does the fact that posts_per_page is being sent in as 'string' ( as
opposed to 'integer' ) makes a difference to WordPress?

2. please take a look at the branch dealing with the 'source' taxonomy, ( -
the last one ). As you see there, the 'source' taxonomy has only one item
to worry about and that is 'sourceX'. In a single term case like that, does
the operator being set as 'IN' as opposed to being set as  'AND' makes a
difference to WordPress?

Sample Advanced Tax. Query

Array
(
    [posts_per_page] => 10   <var_dump reports this as string>
    [order] => DESC
    [tax_query] => Array
        (
            [relation] => AND
            [0] => Array
                (
                    [taxonomy] => category
                    [field] => slug
                    [terms] => Array
                        (
                            [0] => cat1
                            [1] => cat2
                        )

                    [operator] => AND
                    [include_children] =>
                )

            [1] => Array
                (
                    [taxonomy] => post_tag
                    [field] => slug
                    [terms] => Array
                        (
                            [0] => tag 1
                            [1] => tag2
                            [2] => tag3
                        )

                    [operator] => IN
                    [include_children] => 1
                )

            [2] => Array
                (
                    [taxonomy] => source
                    [field] => slug
                    [terms] => Array
                        (
                            [0] => sourceX
                        )

                    [operator] => IN     <on a single term, does IN or
AND matters?>
                    [include_children] => 1
                )

        )

)


More information about the wp-hackers mailing list