{"id":2488,"date":"2021-02-11T09:26:43","date_gmt":"2021-02-11T00:26:43","guid":{"rendered":"https:\/\/blue-bear.jp\/kb\/?p=2488"},"modified":"2021-02-12T11:50:58","modified_gmt":"2021-02-12T02:50:58","slug":"wordpresswp_query%e3%81%ae%e3%83%91%e3%83%a9%e3%83%a1%e3%83%bc%e3%82%bf%e4%b8%80%e8%a6%a7","status":"publish","type":"post","link":"https:\/\/blue-bear.jp\/kb\/wordpresswp_query%e3%81%ae%e3%83%91%e3%83%a9%e3%83%a1%e3%83%bc%e3%82%bf%e4%b8%80%e8%a6%a7\/","title":{"rendered":"[wordpress]WP_Query\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u4e00\u89a7"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>WP_Query\u3092\u4f7f\u7528\u3057\u305fwordpress\u306e\u8a18\u4e8b\u691c\u7d22\u306f\u4ee5\u4e0b\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u9069\u5b9c\u4f7f\u7528\u3059\u308b<\/p>\n<p>\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u306a\u3069\u3082\u691c\u7d22\u5bfe\u8c61\u3068\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd<\/p>\n<pre class=\"lang:default decode:true \"><code>\r\n&lt;?php\r\n$args = array(\r\n\r\n\/\/ \u7279\u5b9a\u306e\u300c\u8457\u8005\u300d\u306b\u95a2\u9023\u4ed8\u3051\u3089\u308c\u305f\u6295\u7a3f\u3092\u8868\u793a\u3059\u308b\u5834\u5408\r\n'author' =&gt; '1,2,3', \/\/ \u8457\u8005ID\u3092\u6307\u5b9a\r\n'author_name' =&gt; 'solecolor', \/\/ user_nicename\u3092\u6307\u5b9a\uff08\u540d\u524d\u3067\u306f\u3042\u308a\u307e\u305b\u3093\uff09\r\n'author__in' =&gt; array(2, 6), \/\/ \u8457\u8005ID\u3092\u914d\u5217\u3067\u6307\u5b9a\uff08\u8457\u8005ID\u3092\u542b\u3080\u8a18\u4e8b\u3092\u7d5e\u308a\u8fbc\u3080\uff09\r\n'author__not_in' =&gt; array(2, 6), \/\/ \u8457\u8005ID\u3092\u914d\u5217\u3067\u6307\u5b9a\uff08\u8457\u8005ID\u3092\u542b\u307e\u306a\u3044\u8a18\u4e8b\u3092\u7d5e\u308a\u8fbc\u3080\uff09\r\n\r\n\/\/ \u7279\u5b9a\u306e\u300c\u30ab\u30c6\u30b4\u30ea\u30fc\u300d\u306b\u95a2\u9023\u4ed8\u3051\u3089\u308c\u305f\u6295\u7a3f\u3092\u8868\u793a\u3059\u308b\u5834\u5408\r\n'cat' =&gt; 5, \/\/ \u30ab\u30c6\u30b4\u30ea\u30fcID\u3092\u6307\u5b9a\r\n'category_name' =&gt; 'daily, news', \/\/ \u30ab\u30c6\u30b4\u30ea\u30fc\u30b9\u30e9\u30c3\u30b0\u3092\u6307\u5b9a\uff08\u8907\u6570\u306e\u5834\u5408\u306f\u300c,\u300d\u3067\u533a\u5207\u308b\uff09\r\n'category__and' =&gt; array(2, 6), \/\/ \u30ab\u30c6\u30b4\u30ea\u30fcID\u3092\u914d\u5217\u3067\u6307\u5b9a\uff08\u30ab\u30c6\u30b4\u30ea\u30fcID\u3092\u542b\u3080\u8a18\u4e8b\u3092\u7d5e\u308a\u8fbc\u3080\uff09\r\n'category__in' =&gt; array(2, 6), \/\/ \u30ab\u30c6\u30b4\u30ea\u30fcID\u3092\u914d\u5217\u3067\u6307\u5b9a\uff08\u30ab\u30c6\u30b4\u30ea\u30fcID\u3092\u542b\u3080\u8a18\u4e8b\u3092\u7d5e\u308a\u8fbc\u3080\uff09\r\n'category__not_in' =&gt; array(2, 6), \/\/ \u30ab\u30c6\u30b4\u30ea\u30fcID\u3092\u914d\u5217\u3067\u6307\u5b9a\uff08\u30ab\u30c6\u30b4\u30ea\u30fcID\u3092\u542b\u307e\u306a\u3044\u8a18\u4e8b\u3092\u7d5e\u308a\u8fbc\u3080\uff09\r\n\r\n\/\/ \u7279\u5b9a\u306e\u300c\u30bf\u30b0\u300d\u306b\u95a2\u9023\u4ed8\u3051\u3089\u308c\u305f\u6295\u7a3f\u3092\u8868\u793a\u3059\u308b\u5834\u5408\r\n'tag' =&gt; 'cooking', \/\/ \u30bf\u30b0\u30b9\u30e9\u30c3\u30b0\u3092\u6307\u5b9a\r\n'tag_id' =&gt; 5, \/\/ \u30bf\u30b0ID\u3092\u6307\u5b9a\r\n'tag__and' =&gt; array(2, 6), \/\/ \u30bf\u30b0ID\u3092\u914d\u5217\u3067\u6307\u5b9a\uff08\u30bf\u30b0ID\u3092\u542b\u3080\u8a18\u4e8b\u3092\u7d5e\u308a\u8fbc\u3080\uff09\r\n'tag__in' =&gt; array(2, 6), \/\/ \u30bf\u30b0ID\u3092\u914d\u5217\u3067\u6307\u5b9a\uff08\u30bf\u30b0ID\u3092\u542b\u3080\u8a18\u4e8b\u3092\u7d5e\u308a\u8fbc\u3080\uff09\r\n'tag__not_in' =&gt; array(2, 6), \/\/ \u30bf\u30b0ID\u3092\u914d\u5217\u3067\u6307\u5b9a\uff08\u30bf\u30b0ID\u3092\u542b\u307e\u306a\u3044\u8a18\u4e8b\u3092\u7d5e\u308a\u8fbc\u3080\uff09\r\n'tag_slug__and' =&gt; array('red', 'blue'), \/\/ \u30bf\u30b0\u30b9\u30e9\u30c3\u30b0\u3092\u914d\u5217\u3067\u6307\u5b9a\uff08\u30bf\u30b0\u30b9\u30e9\u30c3\u30b0\u3092\u542b\u3080\u8a18\u4e8b\u3092\u7d5e\u308a\u8fbc\u3080\uff09\r\n'tag_slug__in' =&gt; array('red', 'blue'), \/\/ \u30bf\u30b0\u30b9\u30e9\u30c3\u30b0\u3092\u914d\u5217\u3067\u6307\u5b9a\uff08\u30bf\u30b0\u30b9\u30e9\u30c3\u30b0\u3092\u542b\u3080\u8a18\u4e8b\u3092\u7d5e\u308a\u8fbc\u3080\uff09\r\n\r\n\/\/ \u7279\u5b9a\u306e\u300c\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u300d\u306b\u95a2\u9023\u4ed8\u3051\u3089\u308c\u305f\u6295\u7a3f\u3092\u8868\u793a\u3059\u308b\u5834\u5408\uff08\u4ee5\u4e0b\u306f\u8907\u6570\u306e\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u306b\u3066AND\u691c\u7d22\uff09\r\n'tax_query' =&gt; array( \/\/\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3092\u6307\u5b9a\r\n'relation' =&gt; 'AND', \/\/ \u30bf\u30af\u30bd\u30ce\u30df\u30fc\u306e\u691c\u7d22\u6761\u4ef6\u306b 'AND' \u304b 'OR' \u304c\u4f7f\u7528\u53ef\u80fd\r\narray(\r\n'taxonomy' =&gt; 'color', \/\/ \u30bf\u30af\u30bd\u30ce\u30df\u30fc\u3092\u6307\u5b9a\r\n'field' =&gt; 'slug', \/\/ term_id(\u30c7\u30d5\u30a9\u30eb\u30c8),name,slug \u306e\u3044\u305a\u308c\u304b\u306e\u30bf\u30fc\u30e0\u306e\u7a2e\u985e\u3092\u9078\u629e\r\n'terms' =&gt; array('red', 'blue'), \/\/ \u30bf\u30fc\u30e0(\u6587\u5b57\u5217\u304bID\u3092\u6307\u5b9a)\r\n'include_children' =&gt; true, \/\/ \u968e\u5c64\u3092\u6301\u3064\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u306e\u5834\u5408\u306b\u3001\u5b50\u5b6b\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u3092\u542b\u3081\u308b\u304b\u3069\u3046\u304b\r\n'operator' =&gt; 'IN' \/\/ \u6f14\u7b97\u5b50'IN','NOT IN','AND','EXISTS'(4.1.0\u4ee5\u964d),'NOT EXISTS'(4.1.0\u4ee5\u964d)\u304c\u5229\u7528\u53ef\u80fd\r\n),\r\narray(\r\n'taxonomy' =&gt; 'actor',\r\n'field' =&gt; 'id',\r\n'terms' =&gt; array(103, 115, 206),\r\n'include_children' =&gt; false,\r\n'operator' =&gt; 'NOT IN'\r\n)\r\n),\r\n\r\n\/\/ \u7279\u5b9a\u306e\u300c\u6295\u7a3f\uff06\u56fa\u5b9a\u30da\u30fc\u30b8\u300d\u306b\u95a2\u9023\u4ed8\u3051\u3089\u308c\u305f\u6295\u7a3f\u3092\u8868\u793a\u3059\u308b\u5834\u5408\r\n'p' =&gt; 1, \/\/ \u6295\u7a3fID\u3092\u6307\u5b9a\r\n'name' =&gt; 'hello-world', \/\/ \u6295\u7a3f\u30b9\u30e9\u30c3\u30b0\u3092\u6307\u5b9a\r\n'page_id' =&gt; 1, \/\/ \u56fa\u5b9a\u30da\u30fc\u30b8\u306eID\u3092\u6307\u5b9a\r\n'pagename' =&gt; 'sample-page', \/\/ \u30da\u30fc\u30b8\u30b9\u30e9\u30c3\u30b0\u3092\u6307\u5b9a\r\n'pagename' =&gt; 'contact_us\/canada', \/\/ \u5b50\u30da\u30fc\u30b8\u3092\u8868\u793a\u3059\u308b\u5834\u5408\u3001\u30b9\u30e9\u30c3\u30b7\u30e5\u533a\u5207\u308a\u3067\u89aa\u3068\u5b50\u306e\u30b9\u30e9\u30c3\u30b0\u3092\u6307\u5b9a\r\n'post_parent' =&gt; 1, \/\/ \u30da\u30fc\u30b8ID\u3092\u6307\u5b9a\u3057\u305f\u5b50\u30da\u30fc\u30b8\u3092\u8868\u793a\r\n'post_parent__in' =&gt; array(1, 2, 3), \/\/ \u914d\u5217\u306e\u89aa\u30da\u30fc\u30b8ID\u3092\u542b\u3080\u6295\u7a3f\u3092\u8868\u793a\r\n'post_parent__not_in' =&gt; array(1, 2, 3), \/\/ \u914d\u5217\u306e\u89aa\u30da\u30fc\u30b8ID\u3092\u542b\u307e\u306a\u3044\u6295\u7a3f\u3092\u8868\u793a\r\n'post__in' =&gt; array(1, 2, 3), \/\/ \u914d\u5217\u306e\u6295\u7a3fID\u3092\u542b\u3080\u6295\u7a3f\u3092\u8868\u793a\r\n'post__not_in' =&gt; array(1, 2, 3), \/\/ \u914d\u5217\u306e\u6295\u7a3fID\u3092\u542b\u307e\u306a\u3044\u6295\u7a3f\u3092\u8868\u793a\r\n\r\n\/\/ \u7279\u5b9a\u306e\u300c\u30d1\u30b9\u30ef\u30fc\u30c9\u300d\u306b\u95a2\u9023\u4ed8\u3051\u3089\u308c\u305f\u6295\u7a3f\u3092\u8868\u793a\u3059\u308b\u5834\u5408\r\n'has_password' =&gt; true, \/\/ \u30d1\u30b9\u30ef\u30fc\u30c9\u4ed8\u304d\u306e\u6295\u7a3f\u3092\u8868\u793a(true or false)\r\n'post_password' =&gt; 'zxcvbn', \/\/ \u7279\u5b9a\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u304c\u4ed8\u3044\u305f\u6295\u7a3f\u3092\u8868\u793a\r\n\r\n\/\/ \u7279\u5b9a\u306e\u300c\u30bf\u30a4\u30d7\u300d\u306b\u95a2\u9023\u4ed8\u3051\u3089\u308c\u305f\u6295\u7a3f\u3092\u8868\u793a\u3059\u308b\u5834\u5408\uff08\u4e00\u3064\u306e\u5834\u5408\uff09\r\n'post_type' =&gt; 'post', \/\/ \u6295\u7a3f\r\n'post_type' =&gt; 'page', \/\/ \u56fa\u5b9a\u30da\u30fc\u30b8\r\n'post_type' =&gt; 'revision', \/\/ \u30ea\u30d3\u30b8\u30e7\u30f3\r\n'post_type' =&gt; 'attachment', \/\/ \u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb\r\n'post_type' =&gt; 'custom-post-type', \/\/ \u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7 or \u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u540d\r\n\r\n\/\/ \u7279\u5b9a\u306e\u300c\u30bf\u30a4\u30d7\u300d\u306b\u95a2\u9023\u4ed8\u3051\u3089\u308c\u305f\u6295\u7a3f\u3092\u8868\u793a\u3059\u308b\u5834\u5408\uff08\u8907\u6570\u306e\u5834\u5408\uff09\r\n'post_type' =&gt; array(\r\n'post', \/\/ \u6295\u7a3f\r\n'page', \/\/ \u56fa\u5b9a\u30da\u30fc\u30b8\r\n'revision', \/\/ \u30ea\u30d3\u30b8\u30e7\u30f3\r\n'attachment', \/\/ \u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb\r\n'custom-post-type' \/\/ \u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7 or \u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u540d\r\n),\r\n\r\n'post_type' =&gt; 'any', \/\/ \u3059\u3079\u3066\u306e\u30bf\u30a4\u30d7\u3092\u542b\u3081\u3066\u8868\u793a(\u30ea\u30d3\u30b8\u30e7\u30f3\u3068'exclude_from_search'\u304ctrue\u306b\u30bb\u30c3\u30c8\u3055\u308c\u305f\u3082\u306e\u3092\u9664\u304f)\r\n\r\n\/\/ \u7279\u5b9a\u306e\u300c\u6295\u7a3f\u30b9\u30c6\u30fc\u30bf\u30b9\u300d\u306b\u95a2\u9023\u4ed8\u3051\u3089\u308c\u305f\u6295\u7a3f\u3092\u8868\u793a\u3059\u308b\u5834\u5408\r\n'post_status' =&gt; array( \/\/\u6295\u7a3f\u30b9\u30c6\u30fc\u30bf\u30b9\u3092\u6307\u5b9a (\u30c7\u30d5\u30a9\u30eb\u30c8'publish')\r\n'publish', \/\/ \u516c\u958b\u3055\u308c\u305f\u6295\u7a3f\u3001\u307e\u305f\u306f\u56fa\u5b9a\u30da\u30fc\u30b8\u3092\u8868\u793a\r\n'pending', \/\/ \u30ec\u30d3\u30e5\u30fc\u5f85\u3061\u306e\u6295\u7a3f\u3092\u8868\u793a\r\n'draft', \/\/ \u4e0b\u66f8\u304d\u306e\u6295\u7a3f\u3092\u8868\u793a\r\n'auto-draft' \/\/ \u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u306a\u3044\u3001\u65b0\u3057\u304f\u4f5c\u6210\u3055\u308c\u305f\u6295\u7a3f\u3092\u8868\u793a\r\n'future', \/\/ \u4e88\u7d04\u516c\u958b\u8a2d\u5b9a\u3055\u308c\u305f\u6295\u7a3f\u3092\u8868\u793a\r\n'private', \/\/ \u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u306a\u3044\u30e6\u30fc\u30b6\u30fc\u306b\u306f\u898b\u3048\u306a\u3044\u6295\u7a3f\u3092\u8868\u793a\r\n'inherit', \/\/ \u30ea\u30d3\u30b8\u30e7\u30f3\u3092\u8868\u793a\r\n'trash', \/\/ \u30b4\u30df\u7bb1\u306b\u5165\u3063\u305f\u6295\u7a3f\u3092\u8868\u793a\r\n),\r\n'post_status' =&gt; 'any', \/\/ \u3059\u3079\u3066\u306e\u30b9\u30c6\u30fc\u30bf\u30b9\u3092\u8868\u793a(\u6295\u7a3f\u30bf\u30a4\u30d7\u3067'exclude_from_search'\u304ctrue\u306b\u30bb\u30c3\u30c8\u3055\u308c\u305f\u3082\u306e\u3092\u9664\u304f)\r\n\r\n\/\/ \u30da\u30fc\u30b8\u9001\u308a\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3092\u8a2d\u5b9a\u3059\u308b\u5834\u5408\r\n'posts_per_page' =&gt; 10, \/\/ 1\u30da\u30fc\u30b8\u3042\u305f\u308a\u306b\u8868\u793a\u3059\u308b\u6295\u7a3f\u6570\u3092\u6307\u5b9a(-1\u3092\u6307\u5b9a\u3059\u308b\u3068\u3059\u3079\u3066\u306e\u6295\u7a3f\u3092\u8868\u793a)\r\n'posts_per_archive_page' =&gt; 10, \/\/ 1\u30da\u30fc\u30b8\u3042\u305f\u308a\u306b\u8868\u793a\u3059\u308b\u6295\u7a3f\u6570(\u30a2\u30fc\u30ab\u30a4\u30d6\u30da\u30fc\u30b8\u306e\u307f)\r\n'nopaging' =&gt; false, \/\/ \u30da\u30fc\u30b8\u9001\u308a\u3092\u4f7f\u7528\u3059\u308b\u304b\u3001\u3059\u3079\u3066\u306e\u6295\u7a3f\u3092\u8868\u793a\u3059\u308b\u304b\u3001(\u30c7\u30d5\u30a9\u30eb\u30c8\u306ffalse\u3067\u30da\u30fc\u30b8\u9001\u308a\u3092\u4f7f\u7528)\r\n'paged' =&gt; 6, \/\/ \u30da\u30fc\u30b8\u756a\u53f76\u306e\u8a18\u4e8b\u3092\u8868\u793a\r\n'paged' =&gt; get_query_var('paged'), \/\/ \u73fe\u5728\u306e\u30da\u30fc\u30b8\u304b\u3089\u6295\u7a3f\u3092\u8868\u793a\r\n'offset' =&gt; 3, \/\/ \u8a2d\u5b9a\u3057\u305f\u6570\u3060\u3051\u3001\u305a\u3089\u3057\u3066\u8868\u793a(\u4f8b\u3067\u306f4\u756a\u76ee\u306e\u6295\u7a3f\u304b\u3089\u8868\u793a)\r\n'ignore_sticky_posts' =&gt; false, \/\/ \u5148\u982d\u56fa\u5b9a\u8868\u793a\u6295\u7a3f\u3092\u7121\u8996\u3059\u308b\u304b\u3069\u3046\u304b(\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306f0\u3067\u5148\u982d\u56fa\u5b9a\u8868\u793a\u6295\u7a3f\u3092\u7121\u8996\u3057\u306a\u3044)\r\n\r\n\/\/ \u300c\u6295\u7a3f\u306e\u4e26\u3073\u9806\u300d\u3092\u6307\u5b9a\u3059\u308b\u5834\u5408\r\n'order' =&gt; 'DESC', \/\/ 'ASC' \u6607\u9806 (1, 2, 3; a, b, c)\r\n\r\n\/\/ 'DESC' \u964d\u9806 (3, 2, 1; c, b, a)\r\n'orderby' =&gt; 'date', \/\/ \u30c7\u30d5\u30a9\u30eb\u30c8\u5024'date' \u8907\u6570\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u6e21\u3059\u3053\u3068\u304c\u53ef\u80fd\r\n\/\/ \u4f8b\uff1a'orderby' =&gt; 'menu_order title'\r\n\r\n\/\/ \u305d\u306e\u4ed6\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\r\n\/\/ 'none' \u4e26\u3073\u66ff\u3048\u306a\u3057\r\n\/\/ 'ID' \u6295\u7a3fID\u3067\u4e26\u3073\u66ff\u3048\r\n\/\/ 'author' \u8457\u8005\u3067\u4e26\u3073\u66ff\u3048\r\n\/\/ 'title' \u30bf\u30a4\u30c8\u30eb\u3067\u4e26\u3073\u66ff\u3048\r\n\/\/ 'name' Order by post name(post slug)\r\n\/\/ 'modified' \u66f4\u65b0\u65e5\u3067\u4e26\u3073\u66ff\u3048\r\n\/\/ 'parent' \u89aa\u30da\u30fc\u30b8ID\u3067\u4e26\u3073\u66ff\u3048\r\n\/\/ 'rand' \u30e9\u30f3\u30c0\u30e0\u9806\r\n\/\/ 'comment_count' \u30b3\u30e1\u30f3\u30c8\u6570\u3067\u4e26\u3073\u66ff\u3048\r\n\/\/ 'menu_order' \u30da\u30fc\u30b8\u306e\u8868\u793a\u9806\u3067\u4e26\u3073\u66ff\u3048\r\n\/\/ 'meta_value' \u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u9806\u3067\u4e26\u3073\u66ff\u3048(\u6570\u5024\u3067\u306f\u3046\u307e\u304f\u3044\u304b\u306a\u3044)\r\n\/\/ 'meta_value_num' \u6570\u5024\u3067\u4e26\u3073\u66ff\u3048\r\n\/\/ 'post__in' post__in\u3067\u914d\u5217\u3067\u6307\u5b9a\u3055\u308c\u305f\u6295\u7a3fID\u306e\u4e26\u3073\u9806\u3092\u7dad\u6301\u3057\u3066\u8868\u793a\r\n\r\n\/\/ \u7279\u5b9a\u306e\u300c\u6642\u9593\u3084\u65e5\u4ed8\u306e\u671f\u9593\u300d\u306b\u95a2\u9023\u4ed8\u3051\u3089\u308c\u305f\u6295\u7a3f\u3092\u8868\u793a\u3059\u308b\u5834\u5408\r\n'year' =&gt; 2015, \/\/ 4\u6841\u306e\u5e74\u3092\u6570\u5b57\u3067\u6307\u5b9a(2015\u306a\u3069)\r\n'monthnum' =&gt; 4, \/\/ \u6708\u3092\u6570\u5b57\u3067\u6307\u5b9a(1\uff5e12)\r\n'w' =&gt; 25, \/\/ \u5e74\u5185\u306e\u9031\u3092\u6570\u5b57\u3067\u6307\u5b9a(0\uff5e53)\r\n'day' =&gt; 17, \/\/ \u6708\u5185\u306e\u65e5\u3092\u6570\u5b57\u3067\u6307\u5b9a(1\uff5e31)\r\n'hour' =&gt; 13, \/\/ \u6642\u9593\u3092\u6570\u5b57\u3067\u6307\u5b9a\uff08 0\uff5e23 \uff09\r\n'minute' =&gt; 19, \/\/ \u5206\u3092\u6570\u5b57\u3067\u6307\u5b9a(0\uff5e60)\r\n'second' =&gt; 30, \/\/ \u79d2\u3092\u6570\u5b57\u3067\u6307\u5b9a(0\uff5e60)\r\n'm' =&gt; 201404, \/\/ \u5e74\u3068\u6708\u3092\u6570\u5b57\u3067\u6307\u5b9a (201508\u306a\u3069)\r\n\r\n\/\/ \u300c\u25cb\u5e74\u25cb\u6708\u25cb\u65e5\u304b\u3089\u25cb\u5e74\u25cb\u6708\u25cb\u65e5\u306e\u7bc4\u56f2\u306e\u6295\u7a3f\u60c5\u5831\u300d\u3092\u8868\u793a\u3059\u308b\u5834\u5408(\u6295\u7a3f\u65e5\u306e\u691c\u7d22\u304c\u81ea\u7531\u81ea\u5728!)\r\n'date_query' =&gt; array(\r\narray(\r\n'year' =&gt; 2015, \/\/ 4\u6841\u306e\u5e74\u3092\u6570\u5b57\u3067\u6307\u5b9a(2015\u306a\u3069)\r\n'month' =&gt; 8 \/\/ \u6708\u3092\u6570\u5b57\u3067\u6307\u5b9a(1\uff5e12)\r\n'week' =&gt; 31 \/\/ \u5e74\u5185\u306e\u9031\u3092\u6570\u5b57\u3067\u6307\u5b9a(0\uff5e53)\r\n'day' =&gt; 5 \/\/ \u6708\u5185\u306e\u65e5\u3092\u6570\u5b57\u3067\u6307\u5b9a(1\uff5e31)\r\n'hour' =&gt; 2 \/\/ \u6642\u9593\u3092\u6570\u5b57\u3067\u6307\u5b9a\uff08 0\uff5e23 \uff09\r\n'minute' =&gt; 3 \/\/ \u5206\u3092\u6570\u5b57\u3067\u6307\u5b9a(0\uff5e60)\r\n'second' =&gt; 36 \/\/ \u79d2\u3092\u6570\u5b57\u3067\u6307\u5b9a(0\uff5e60)\r\n'after' =&gt; 'January 1st, 2013', \/\/ \u6307\u5b9a\u3057\u305f\u65e5\u4ed8\u4ee5\u964d\u306e\u6295\u7a3f\u3092\u53d6\u5f97\u3002strtotime()\u3068\u4e92\u63db\u6027\u306e\u3042\u308b\u6587\u5b57\u5217\u3067'after'=&gt;'2015\/08\/31'\u306a\u3069\u3067\u3082OK\r\n'before' =&gt; array( \/\/\u6307\u5b9a\u3057\u305f\u65e5\u4ed8\u4ee5\u524d\u306e\u6295\u7a3f\u3092\u53d6\u5f97\u3002strtotime()\u3068\u4e92\u63db\u6027\u306e\u3042\u308b\u6587\u5b57\u5217\u3067'before'=&gt;'2015\/08\/31'\u306a\u3069\u3067\u3082OK\r\n'year' =&gt; 2013, \/\/ 4\u6841\u306e\u5e74\u3092\u6570\u5b57\u3067\u6307\u5b9a(2015\u306a\u3069) \u30c7\u30d5\u30a9\u30eb\u30c8\u306f\u7a7a\r\n'month' =&gt; 2, \/\/ \u5e74\u5185\u306e\u6708\u3092\u6570\u5b57\u3067\u6307\u5b9a(1\uff5e12) \u30c7\u30d5\u30a9\u30eb\u30c8\u306f12\r\n'day' =&gt; 28, \/\/ \u6708\u5185\u306e\u65e5\u3092\u6570\u5b57\u3067\u6307\u5b9a(1\uff5e31) \u30c7\u30d5\u30a9\u30eb\u30c8\u306f\u6708\u5185\u306e\u672b\u65e5\r\n),\r\n'inclusive' =&gt; true, \/\/\u300cafter\u300d\u307e\u305f\u306f\u300cbefore\u300d\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3067\u6307\u5b9a\u3055\u308c\u305f\u5024\u3092\u542b\u3080\u304b\u3069\u3046\u304b\r\n'compare' =&gt; '=', \/\/ \u4f7f\u7528\u53ef\u80fd\u306a\u5024\u306f '=', '!=', '&gt;', '&gt;=', '&lt;', '&lt;=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN', 'EXISTS', and 'NOT EXISTS'\r\n'column' =&gt; 'post_date', \/\/ \u7167\u4f1a\u3059\u308b\u30ab\u30e9\u30e0\u3092\u6307\u5b9a\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u306f\u300cpost_date\u300d\r\n'relation' =&gt; 'AND', \/\/ OR \u307e\u305f\u306f AND \u30c7\u30d5\u30a9\u30eb\u30c8\u306f\u300cAND\u300d\r\n),\r\n),\r\n\r\n\/\/ \u7279\u5b9a\u306e\u300c\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u300d\u306b\u95a2\u9023\u4ed8\u3051\u3089\u308c\u305f\u6295\u7a3f\u3092\u8868\u793a\u3059\u308b\u5834\u5408\r\n'meta_key' =&gt; 'key', \/\/ \u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u30ad\u30fc\u3092\u6307\u5b9a\r\n'meta_value' =&gt; 'value', \/\/ \u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u5024\u3092\u6307\u5b9a\r\n'meta_value_num' =&gt; 10, \/\/ \u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u5024\u3092\u6307\u5b9a\r\n'meta_compare' =&gt; '=', \/\/\u300cmeta_value\u300d\u3092\u30c6\u30b9\u30c8\u3059\u308b\u6f14\u7b97\u5b50\u3002\u4f7f\u3048\u308b\u5024\u306f'!='\u3001'&gt;'\u3001'&gt;='\u3001'&lt;'\u3001'=' \u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306f'='\r\n'meta_query' =&gt; array( \/\/\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\r\n'relation' =&gt; 'AND', \/\/ \u300cAND\u300d\u307e\u305f\u306f\u300cOR\u300d\u3092\u6307\u5b9a\u3002meta_query\u5185\u306e\u914d\u5217\u304c\u300c2\u3064\u4ee5\u4e0a\u300d\u306e\u5834\u5408\u306b\u9650\u308b\u3002meta_query\u914d\u5217\u304c1\u3064\u306e\u5834\u5408\u306f\u4f7f\u7528\u3057\u306a\u3044\u3002\r\narray(\r\n'key' =&gt; 'color', \/\/ \u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u30ad\u30fc\u3002\r\n'value' =&gt; 'blue', \/\/ \u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u5024 (\u6ce8\u610f compare\u306e\u5024\u304c'IN'\u3001'NOT IN'\u3001'BETWEEN'\u3001'NOT BETWEEN'\u306e\u307f\u914d\u5217\u3092\u30b5\u30dd\u30fc\u30c8)\r\n'type' =&gt; 'CHAR', \/\/ \u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u30bf\u30a4\u30d7\u3002\u30bf\u30a4\u30d7\u306b\u3064\u3044\u3066\u306f\u4ee5\u4e0b\u306e\u300cmeta_query\u3067\u4f7f\u3048\u308b\u30c7\u30fc\u30bf\u578b\u300d\u53c2\u7167\r\n'compare' =&gt; '=', \/\/ \u6f14\u7b97\u5b50\u3092\u6307\u5b9a \u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306f'=' \u6f14\u7b97\u5b50\u306e\u7a2e\u985e\u306b\u3064\u3044\u3066\u306f\u4ee5\u4e0b\u300cmeta_query\u3067\u6307\u5b9a\u3067\u304d\u308b\u6f14\u7b97\u5b50\u306e\u7a2e\u985e\u300d\u53c2\u7167\r\n),\r\narray(\r\n'key' =&gt; 'price',\r\n'value' =&gt; array(1,200),\r\n'compare' =&gt; 'NOT LIKE',\r\n)\r\n),\r\n\r\n\/\/ \u9069\u5207\u306a\u6a29\u9650\u3092\u6301\u3063\u3066\u3044\u308b\u30e6\u30fc\u30b6\u30fc\u306e\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u306e\u8a18\u4e8b\u3092\u8868\u793a\u3059\u308b\u5834\u5408\r\n'perm' =&gt; 'readable' \/\/ \u4f7f\u3048\u308b\u5024\u306f\u2019readable\u2019\u3068\u2019editable\u2019\r\n\r\n\/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u7cfb\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\r\n'cache_results' =&gt; true, \/\/ \u6295\u7a3f\u60c5\u5831\u3092\u30ad\u30e3\u30c3\u30b7\u30e5\u3059\u308b\u304b\u3069\u3046\u304b \u30c7\u30d5\u30a9\u30eb\u30c8\u306ftrue\r\n'update_post_term_cache' =&gt; true, \/\/ \u6295\u7a3f\u30bf\u30fc\u30e0\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u66f4\u65b0\u3059\u308b\u304b\u3069\u3046\u304b \u30c7\u30d5\u30a9\u30eb\u30c8\u306ftrue\r\n'update_post_meta_cache' =&gt; true, \/\/ \u6295\u7a3f\u30e1\u30bf\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u66f4\u65b0\u3059\u308b\u304b\u3069\u3046\u304b \u30c7\u30d5\u30a9\u30eb\u30c8\u306ftrue\r\n'no_found_rows' =&gt; false, \/\/ \u30ab\u30a6\u30f3\u30c8\u3092\u30b9\u30ad\u30c3\u30d7\u3059\u308b\uff1f ture\u3067\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u304c\u5411\u4e0a\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u304b\u3082 \u30c7\u30d5\u30a9\u30eb\u30c8\u306ffalse\r\n\r\n\/\/ \u691c\u7d22\u7cfb\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\r\n's' =&gt; $s, \/\/ \u691c\u7d22\u304b\u3089\u30af\u30a8\u30ea\u30fc\u30b9\u30c8\u30ea\u30f3\u30b0\u5024\u3092\u6e21\u3057\u307e\u3059\u3002\r\n'exact' =&gt; true, \/\/\u30bf\u30a4\u30c8\u30eb\uff0f\u6295\u7a3f\u306e\u5168\u4f53\u304b\u3089\u6b63\u78ba\u306a\u30ad\u30fc\u30ef\u30fc\u30c9\u3067\u691c\u7d22\u3059\u308b\u304b \u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306ffalse\r\n'sentence' =&gt; true, \/\/\u8a9e\u53e5(\u30d5\u30ec\u30fc\u30ba\u691c\u7d22)\u3067\u691c\u7d22\u3059\u308b\u304b \u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306ffalse\r\n\r\n\/\/ \u6295\u7a3f\u30d5\u30a3\u30fc\u30eb\u30c9\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\r\n'fields' =&gt; 'ids' \u3000\/\/\uff11\u3064\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u3067\u8fd4\u3059\u304b\u5168\u3066\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u3067\u8fd4\u3059\u304b \u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u5168\u3066\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u304c\u8fd4\u3055\u308c\u308b\r\n\r\n\/\/ \u4f7f\u7528\u3067\u304d\u308b\u5024\r\n\/\/ 'ids' \u6295\u7a3f\u306eID\u306e\u914d\u5217\u3092\u8fd4\u3057\u307e\u3059\r\n\/\/ 'id=&gt;parent' \u9023\u60f3\u914d\u5217\u3092\u8fd4\u3057\u307e\u3059\r\n);\r\n\r\n$the_query = new WP_Query($args);\r\nif ($the_query-&gt;have_posts()):\r\nwhile ($the_query-&gt;have_posts()): $the_query-&gt;the_post();\r\n\r\n\/\/ \u4f55\u304b\u3057\u3089\u306e\u51e6\u7406\r\nendwhile;\r\nendif;\r\n\r\n\/\/ \u6295\u7a3f\u30c7\u30fc\u30bf\u306e\u30ea\u30bb\u30c3\u30c8\r\nwp_reset_query();\r\n?&gt;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; WP_Query\u3092\u4f7f\u7528\u3057\u305f<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[236,235],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/2488"}],"collection":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/comments?post=2488"}],"version-history":[{"count":3,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/2488\/revisions"}],"predecessor-version":[{"id":2492,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/2488\/revisions\/2492"}],"wp:attachment":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/media?parent=2488"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/categories?post=2488"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/tags?post=2488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}