{"id":163898,"date":"2013-07-28T21:26:10","date_gmt":"2013-07-28T12:26:10","guid":{"rendered":"https:\/\/ja.wordpress.org\/support\/2013\/07\/28\/tax_query%e5%86%85%e3%81%aeoperator%e3%81%aein%e3%81%a8and%e3%82%92taxonomy%e5%88%a5%e3%81%a7%e4%bd%bf%e3%81%84%e5%88%86%e3%81%91%e3%82%8b%e6%96%b9%e6%b3%95\/"},"modified":"2013-07-28T21:26:10","modified_gmt":"2013-07-28T12:26:10","slug":"tax_query%e5%86%85%e3%81%aeoperator%e3%81%aein%e3%81%a8and%e3%82%92taxonomy%e5%88%a5%e3%81%a7%e4%bd%bf%e3%81%84%e5%88%86%e3%81%91%e3%82%8b%e6%96%b9%e6%b3%95","status":"closed","type":"topic","link":"https:\/\/ja.wordpress.org\/support\/topic\/tax_query%e5%86%85%e3%81%aeoperator%e3%81%aein%e3%81%a8and%e3%82%92taxonomy%e5%88%a5%e3%81%a7%e4%bd%bf%e3%81%84%e5%88%86%e3%81%91%e3%82%8b%e6%96%b9%e6%b3%95\/","title":{"rendered":"tax_query\u5185\u306eoperator\u306eIN\u3068AND\u3092taxonomy\u5225\u3067\u4f7f\u3044\u5206\u3051\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>\u521d\u3081\u307e\u3057\u3066\u3002<br \/>\n\u73fe\u5728wordpress\u3092\u4f7f\u3044\u59cb\u3081\u3066\uff11\u30f6\u6708\u3082\u7d4c\u3063\u3066\u3044\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u691c\u7d22\u3067\u60a9\u3093\u3067\u3044\u307e\u3059\u3002<br \/>\n\u3084\u308a\u305f\u3044\u4e8b\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306a\u3082\u306e\u306a\u306e\u3067\u3059\u304c\u3001\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u3084\u30bb\u30ec\u30af\u30c8\u306emultiple\u3067\u8907\u6570\u9078\u629e\u3092\u884c\u3063\u305f\u969b\u306b<br \/>\ntax_query\u5185\u306b\u6307\u5b9a\u3057\u305f&#8217;operator&#8217;=&gt;&#8217;IN&#8217;\u3092taxonomy\u9805\u76ee\u5225\u3067&#8217;operator&#8217;=&gt;&#8217;AND&#8217;\u306b\u51fa\u6765\u306a\u3044\u304b\u3068\u60a9\u3093\u3067\u3044\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070<br \/>\ntaxonomy\u9805\u76ee\uff11\u5185\u3092\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u307e\u305f\u306f\u30bb\u30ec\u30af\u30c8\u306emultiple\u3067\u300cslugA,slugB,slugC\u300d\u3092\u9078\u629e\u3057<\/p>\n<p>taxonomy\u9805\u76ee\uff12\u5185\u3092\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9\u307e\u305f\u306f\u30bb\u30ec\u30af\u30c8\u306emultiple\u3067\u300cslugA,slugB,slugC,slugD\u300d\u3092\u9078\u629e\u3002<br \/>\n\u3053\u3053\u307e\u3067\u306f\u3044\u305a\u308c\u304b\u3068\u5408\u81f4\u3057\u305f\u3082\u306e\u3067\u826f\u3044\u306e\u3067&#8217;operator&#8217;=&gt;&#8217;IN&#8217;\u3067\u826f\u3044\u306e\u3067\u3059\u304c\u3001<\/p>\n<p>taxonomy\u9805\u76ee\uff13\u5185\u306e\u6761\u4ef6\u3092\u300cslugA,slugB,slugC\u300d\u3053\u3061\u3089\u306e\u5168\u3066\u5408\u81f4\u3057\u305f\u3082\u306e\u3092\u51fa\u529b\u3055\u305b\u305f\u3044\u3068\u601d\u3044&#8217;operator&#8217;=&gt;&#8217;AND&#8217;\u306b\u3057\u305f\u3044\u3067\u3059\u3002<\/p>\n<p>\u4e0b\u8a18\u53c2\u8003\u30b5\u30a4\u30c8\u306e\u5185\u5bb9\u3060\u3068\u5168\u3066&#8217;operator&#8217;=&gt;&#8217;IN&#8217;\u3068\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u3067<br \/>\n\u300cslugA,slugB,slugC\u300d\u306e\u3044\u305a\u308c\u304b\u304c\u5408\u81f4\u3059\u308b\u3082\u306e\u307e\u3067\u51fa\u529b\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<p>\u53c2\u8003\u30b5\u30a4\u30c8<br \/>\n<a href=\"http:\/\/wood-roots.com\/web%E5%88%B6%E4%BD%9C\/wordpress-web%E5%88%B6%E4%BD%9C\/%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E3%82%BF%E3%82%AF%E3%82%BD%E3%83%8E%E3%83%9F%E3%83%BC%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%9F%E8%A4%87%E9%9B%91%E3%81%AA%E6%9D%A1%E4%BB%B6%E6%A4%9C%E7%B4%A2\">\u30ab\u30b9\u30bf\u30e0\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u3092\u4f7f\u3063\u305f\u8907\u96d1\u306a\u6761\u4ef6\u691c\u7d22<\/a><br \/>\n\u3068<br \/>\n<a href=\"http:\/\/elearn.jp\/wpman\/column\/c20110908_01.html\">\u79c1\u7684\u30de\u30cb\u30e5\u30a2\u30eb<\/a><\/p>\n<p>\u73fe\u5728\u79c1\u304c\u4f7f\u7528\u3057\u3066\u3044\u308b\u30b3\u30fc\u30c9\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\nHTML\u5185<\/p>\n<pre><code>&lt;form mephod=&quot;get&quot; action=&quot;\/&quot;&gt;\n        &lt;dl&gt;\n          &lt;dt&gt;taxonomy\u9805\u76ee\uff11\u3092\u9078\u629e&lt;\/dt&gt;\n          &lt;dd&gt;\n            &lt;select name=&quot;taxonomy\u9805\u76ee\uff11[]&quot; multiple=&quot;multiple&quot;&gt;\n              &lt;option disabled=&quot;disabled&quot;&gt;taxonomy\u9805\u76ee\uff11\u3092\u9078\u629e&lt;\/option&gt;\n              &lt;?php\n\t\t\t\t\t\t\t$terms = get_terms(&#039;taxonomy\u9805\u76ee\uff11&#039;);\n\t\t\t\t\t\t\tforeach ($terms as $term): ?&gt;\n              &lt;option value=&quot;&lt;?php echo esc_html($term-&gt;slug); ?&gt;&quot;&gt;&lt;?php echo esc_html($term-&gt;name); ?&gt;&lt;\/option&gt;\n              &lt;?php endforeach; ?&gt;\n            &lt;\/select&gt;\n          &lt;\/dd&gt;\n          &lt;dt&gt;taxonomy\u9805\u76ee\uff12\u3092\u9078\u629e&lt;\/dt&gt;\n          &lt;dd&gt;\n            &lt;select name=&quot;taxonomy\u9805\u76ee\uff12[]&quot; multiple=&quot;multiple&quot;&gt;\n              &lt;option disabled=&quot;disabled&quot;&gt;taxonomy\u9805\u76ee\uff12\u3092\u9078\u629e&lt;\/option&gt;\n              &lt;?php\n\t\t\t\t\t\t\t$terms = get_terms(&#039;taxonomy\u9805\u76ee\uff12&#039;);\n\t\t\t\t\t\t\tforeach ($terms as $term): ?&gt;\n              &lt;option value=&quot;&lt;?php echo esc_html($term-&gt;slug); ?&gt;&quot;&gt;&lt;?php echo esc_html($term-&gt;name); ?&gt;&lt;\/option&gt;\n              &lt;?php endforeach; ?&gt;\n            &lt;\/select&gt;\n          &lt;\/dd&gt;\n          &lt;dt&gt;taxonomy\u9805\u76ee\uff13\u3092\u9078\u629e&lt;\/dt&gt;\n          &lt;dd&gt;\n            &lt;select name=&quot;taxonomy\u9805\u76ee\uff13[]&quot; multiple=&quot;multiple&quot;&gt;\n              &lt;option disabled=&quot;disabled&quot;&gt;taxonomy\u9805\u76ee\uff13\u3092\u9078\u629e&lt;\/option&gt;\n              &lt;?php\n\t\t\t\t\t\t\t$terms = get_terms(&#039;taxonomy\u9805\u76ee\uff13&#039;);\n\t\t\t\t\t\t\tforeach ($terms as $term): ?&gt;\n              &lt;option value=&quot;&lt;?php echo esc_html($term-&gt;slug); ?&gt;&quot;&gt;&lt;?php echo esc_html($term-&gt;name); ?&gt;&lt;\/option&gt;\n              &lt;?php endforeach; ?&gt;\n            &lt;\/select&gt;\n          &lt;\/dd&gt;\n        &lt;\/dl&gt;\n    &lt;input type=&quot;submit&quot; value=&quot;\u691c\u7d22&quot;\/&gt;\n   &lt;\/form&gt;<\/code><\/pre>\n<p>\u53d7\u3051\u5074\u3000\u3053\u3061\u3089\u306f\u305d\u306e\u307e\u307e\u4f7f\u7528\u3055\u305b\u3066\u3044\u305f\u3060\u3044\u3066\u3044\u307e\u3059<\/p>\n<pre><code>&lt;?php\n      if($_GET){\n\t\t  $qarr = array(\n\t\t&#039;numberposts&#039; =&gt; 10,\n\t\t&#039;post_status&#039; =&gt; &#039;publish&#039;,\n\t\t&#039;post_type&#039; =&gt; &#039;post\u540d&#039;,\n\t\t&#039;tax_query&#039; =&gt; array(\n  \t    &#039;relation&#039; =&gt; &#039;AND&#039;,\n    )\n);\n\nforeach( $_GET as $key =&gt; $value ) {\narray_push($qarr[&quot;tax_query&quot;],array(\n        &#039;taxonomy&#039; =&gt; $key,\n        &#039;field&#039; =&gt; &#039;slug&#039;,\n        &#039;terms&#039; =&gt; $value,\n\t\t&#039;operator&#039;=&gt;&#039;IN&#039;\t\/\/\u3053\u306e\u90e8\u5206\u3092IN\u3068AND\u306b\u5909\u3048\u305f\u3044\u3068\u601d\u3063\u3066\u3044\u307e\u3059\u3002\n        ));\n    }\n} else {\n    $qarr = &#039;&#039;;\n}\n?&gt;\n&lt;?php $myposts = get_posts($qarr); ?&gt;<\/code><\/pre>\n<p>\u30a2\u30c9\u30d0\u30a4\u30b9\u306a\u3069\u3054\u6559\u6388\u3044\u305f\u3060\u3051\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u5b9c\u3057\u304f\u304a\u9858\u3044\u81f4\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"template":"","class_list":["post-163898","topic","type-topic","status-closed","hentry","topic-tag-17889","topic-tag-operator","topic-tag-tax_query","topic-tag-20747"],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/163898","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/163898\/revisions"}],"wp:attachment":[{"href":"https:\/\/ja.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=163898"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}