{"id":3841,"date":"2026-09-01T06:55:00","date_gmt":"2026-08-31T21:55:00","guid":{"rendered":"https:\/\/wptoolslab.com\/query-lab\/?post_type=wpq_article&#038;p=3841"},"modified":"2026-09-01T06:45:22","modified_gmt":"2026-08-31T21:45:22","slug":"wp-query-category-filter-not-working","status":"publish","type":"wpq_article","link":"https:\/\/wptoolslab.com\/query-lab\/articles\/wp-query-category-filter-not-working\/","title":{"rendered":"WP_Query\u3067\u30ab\u30c6\u30b4\u30ea\u30fc\u7d5e\u308a\u8fbc\u307f\u304c\u52b9\u304b\u306a\u3044\u539f\u56e0\uff5c\u6307\u5b9a\u65b9\u6cd5\u3068tax_query\u3092\u78ba\u8a8d"},"content":{"rendered":"<section class=\"conclusion wpq-conclusion\"><h2 class=\"wpq-conclusion__title\">0\u4ef6\u306a\u3089\u6700\u521d\u306b\u5f15\u6570\u3068ID\u30fbslug\u3092\u78ba\u8a8d\u3059\u308b<\/h2><p>\u307e\u305a\u30b3\u30fc\u30c9\u306e`$args`\u3092\u958b\u304d\u3001WordPress\u7ba1\u7406\u753b\u9762\u306e\u300c\u6295\u7a3f > \u30ab\u30c6\u30b4\u30ea\u30fc\u300d\u3067ID\u3068\u30b9\u30e9\u30c3\u30b0\u3092\u8abf\u3079\u307e\u3059\u3002`cat`\u3068`category__in`\u306b\u306f\u30ab\u30c6\u30b4\u30ea\u30fcID\u3001`category_name`\u306b\u306f\u30ab\u30c6\u30b4\u30ea\u30fcslug\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>\u5024\u304c\u5408\u3063\u3066\u3044\u308b\u306e\u306b0\u4ef6\u3084\u5225\u30ab\u30c6\u30b4\u30ea\u30fc\u6df7\u5728\u304c\u7d9a\u304f\u5834\u5408\u306f\u3001\u5b50\u30ab\u30c6\u30b4\u30ea\u30fc\u3092\u542b\u3080\u7bc4\u56f2\u3001`tax_query`\u3001`post_type`\u3001\u8ffd\u52a0\u6761\u4ef6\u306e\u9806\u306b\u5916\u3057\u3066\u78ba\u8a8d\u3057\u307e\u3059\u3002\u30ab\u30b9\u30bf\u30e0\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u306f\u901a\u5e38\u306e\u30ab\u30c6\u30b4\u30ea\u30fc\u5f15\u6570\u3067\u306f\u306a\u304f`tax_query`\u3067\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<\/section>\n<h2 id=\"symptoms\" class=\"h-underline section-heading\"><span class=\"section-heading-icon\" aria-hidden=\"true\"><svg data-wpq-icon=\"warning\" aria-hidden=\"true\" focusable=\"false\" class=\"wpq-icon-svg\"\n  xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n \n \n  viewBox=\"0 0 24 24\"\n  fill=\"none\"\n  stroke=\"currentColor\"\n  stroke-width=\"2\"\n  stroke-linecap=\"round\"\n  stroke-linejoin=\"round\"\n>\n  <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" \/>\n  <path d=\"M12 9v4\" \/>\n  <path d=\"M12 17h.01\" \/>\n<\/svg><\/span><span class=\"section-heading-text\">0\u4ef6\u30fb\u5225\u30ab\u30c6\u30b4\u30ea\u30fc\u6df7\u5728\u30fb\u5b50\u30ab\u30c6\u30b4\u30ea\u30fc\u306e\u75c7\u72b6\u3092\u5206\u3051\u308b<\/span><\/h2>\n<p>\u6295\u7a3f\u304c\u51fa\u306a\u3044\u3001\u5225\u30ab\u30c6\u30b4\u30ea\u307e\u3067\u6df7\u3056\u308b\u3001\u5b50\u30ab\u30c6\u30b4\u30ea\u306e\u6271\u3044\u304c\u9055\u3046\u3001\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u3060\u3051\u52b9\u304b\u306a\u3044\u3001\u3068\u3044\u3046\u75c7\u72b6\u3054\u3068\u306b\u78ba\u8a8d\u5148\u3092\u5206\u3051\u307e\u3059\u3002<\/p>\n<div class=\"wpq-table-block\"><p class=\"wpq-table-hint\" aria-hidden=\"true\">\u8868\u306f\u6a2a\u306b\u30b9\u30af\u30ed\u30fc\u30eb\u3067\u304d\u307e\u3059<\/p><div class=\"cause-table table-scroll wpq-table-wrap\" role=\"region\" tabindex=\"0\" aria-label=\"\u8868: \u75c7\u72b6 \/ \u6700\u521d\u306b\u7591\u3046\u539f\u56e0 \/ \u78ba\u8a8d\u3059\u308b\u5834\u6240\"><table class=\"article-table table-priority wpq-article-table\"><thead><tr><th>\u75c7\u72b6<\/th><th>\u6700\u521d\u306b\u7591\u3046\u539f\u56e0<\/th><th>\u78ba\u8a8d\u3059\u308b\u5834\u6240<\/th><\/tr><\/thead><tbody><tr><td>\u6295\u7a3f\u304c1\u4ef6\u3082\u51fa\u306a\u3044<\/td><td>\u30ab\u30c6\u30b4\u30eaID\u3068slug\u306e\u53d6\u308a\u9055\u3048\u3001post_type\u9055\u3044\u3001\u516c\u958b\u72b6\u614b\u9055\u3044<\/td><td>$args \u306e <code>cat<\/code> \/ <code>category_name<\/code> \/ <code>post_type<\/code><\/td><\/tr><tr><td>\u5225\u30ab\u30c6\u30b4\u30ea\u306e\u8a18\u4e8b\u3082\u51fa\u308b<\/td><td>OR\u6761\u4ef6\u306b\u306a\u3063\u3066\u3044\u308b\u3001\u30ab\u30c6\u30b4\u30ea\u6307\u5b9a\u304c\u5e83\u3059\u304e\u308b\u3001\u5b50\u30ab\u30c6\u30b4\u30ea\u3092\u542b\u3093\u3067\u3044\u308b<\/td><td><code>cat<\/code>\u3001<code>category_name<\/code>\u3001<code>tax_query<\/code> \u306e\u6307\u5b9a<\/td><\/tr><tr><td>\u5b50\u30ab\u30c6\u30b4\u30ea\u306e\u8a18\u4e8b\u304c\u51fa\u305f\u308a\u51fa\u306a\u304b\u3063\u305f\u308a\u3059\u308b<\/td><td>\u5b50\u30ab\u30c6\u30b4\u30ea\u3092\u542b\u3080\u6307\u5b9a\u3068\u542b\u307e\u306a\u3044\u6307\u5b9a\u306e\u6df7\u540c<\/td><td><code>cat<\/code> \/ <code>category_name<\/code> \u3068 <code>category__in<\/code> \u306e\u9055\u3044<\/td><\/tr><tr><td>\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u3060\u3051\u51fa\u306a\u3044<\/td><td>\u305d\u306e\u6295\u7a3f\u30bf\u30a4\u30d7\u306b\u30ab\u30c6\u30b4\u30ea\u30fc\u304c\u7d10\u3065\u3044\u3066\u3044\u306a\u3044\u3001\u6295\u7a3f\u30bf\u30a4\u30d7\u6307\u5b9a\u304c\u9055\u3046<\/td><td>\u6295\u7a3f\u30bf\u30a4\u30d7\u767b\u9332\u3068 <code>post_type<\/code><\/td><\/tr><tr><td>\u30ab\u30b9\u30bf\u30e0\u5206\u985e\u3067\u52b9\u304b\u306a\u3044<\/td><td>\u901a\u5e38\u306e\u30ab\u30c6\u30b4\u30ea\u30fc\u5f15\u6570\u3092\u4f7f\u3063\u3066\u3044\u308b<\/td><td><code>tax_query<\/code> \u306e <code>taxonomy<\/code><\/td><\/tr><\/tbody><\/table><\/div><\/div>\n<p>\u30ab\u30c6\u30b4\u30ea\u4ee5\u5916\u306etaxonomy\u3082\u542b\u3080\u57fa\u672c\u69cb\u6587\u306f[tax_query\u306e\u4f7f\u3044\u65b9](..\/tax-query-filtering\/)\u3067\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002\u8907\u6570\u6761\u4ef6\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u3044\u308b\u5834\u5408\u306f\u3001[relation\u306eAND \/ OR\u306e\u9055\u3044](..\/tax-query-relation-and-or\/)\u3082\u6761\u4ef6\u30921\u3064\u306b\u623b\u3057\u305f\u5f8c\u3067\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>WP_Query\u306e\u30ab\u30c6\u30b4\u30ea\u6307\u5b9a\u306b\u306f\u3001\u4f3c\u305f\u540d\u524d\u306e\u5f15\u6570\u304c\u3044\u304f\u3064\u3082\u3042\u308a\u307e\u3059\u3002`cat`\u3001`category_name`\u3001`category__in`\u3001`category__and`\u3001`category__not_in` \u306f\u3001\u3069\u308c\u3082\u30ab\u30c6\u30b4\u30ea\u30fc\u306b\u95a2\u4fc2\u3057\u307e\u3059\u304c\u3001\u53d7\u3051\u53d6\u308b\u5024\u3068\u52d5\u304d\u304c\u540c\u3058\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<h3 id=\"id-slug-mismatch\" class=\"wpq-subheading\">\u539f\u56e01: ID\u3068slug\u3092\u53d6\u308a\u9055\u3048\u3066\u3044\u308b<\/h3>\n<p>`cat`\u306b\u306f\u30ab\u30c6\u30b4\u30eaID\u3001`category_name`\u306b\u306f\u30ab\u30c6\u30b4\u30easlug\u3092\u4f7f\u3044\u307e\u3059\u3002\u8868\u793a\u540d\u304c\u300c\u30cb\u30e5\u30fc\u30b9\u300d\u3067slug\u304c`news`\u306e\u5834\u5408\u3001`category_name`\u306b\u5165\u308c\u308b\u306e\u306f`news`\u3067\u3059\u3002\u65e5\u672c\u8a9e\u306e\u8868\u793a\u540d\u3092\u305d\u306e\u307e\u307e\u5165\u308c\u308b\u3068\u3001\u671f\u5f85\u901a\u308a\u306b\u4e00\u81f4\u3057\u306a\u3044\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<span class=\"wpq-marker wpq-marker--yellow\">\u8868\u793a\u540d\u3068slug\u306f\u540c\u3058\u3068\u306f\u9650\u308a\u307e\u305b\u3093\u3002\u30b3\u30fc\u30c9\u3078\u5165\u308c\u308b\u524d\u306b\u3001\u7ba1\u7406\u753b\u9762\u306e\u300c\u30b9\u30e9\u30c3\u30b0\u300d\u5217\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/span>\n<p>`category__in` \u3084 `category__and` \u3082\u3001\u57fa\u672c\u7684\u306b\u306f\u30ab\u30c6\u30b4\u30eaID\u306e\u914d\u5217\u3092\u4f7f\u3044\u307e\u3059\u3002slug\u3067\u6307\u5b9a\u3057\u305f\u3044\u306a\u3089 `category_name` \u304b\u3001`tax_query` \u3067 `field` \u3092 `slug` \u306b\u3059\u308b\u65b9\u6cd5\u3092\u691c\u8a0e\u3057\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306e\u4e00\u89a7\u3067\u306f\u3001\u8868\u793a\u540d\u300c\u30a4\u30d9\u30f3\u30c8\u6848\u5185\u300d\u306e\u884c\u306bslug\u306e`events`\u3068\u6570\u5024\u306eID\u304c\u5225\u3005\u306b\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u81ea\u5206\u306e\u30b5\u30a4\u30c8\u3067\u3082\u540c\u3058\u5217\u3092\u898b\u3066\u3001\u30b3\u30fc\u30c9\u3078\u6e21\u3059\u5024\u3092\u9078\u3093\u3067\u304f\u3060\u3055\u3044\u3002<\/p>\n<figure class=\"wpq-screenshot-frame wpq-screenshot-frame--fit-contain\"><span class=\"wpq-screenshot-frame__media\" style=\"--wpq-screenshot-ratio:16 \/ 5;\"><img decoding=\"async\" src=\"https:\/\/wptoolslab.com\/query-lab\/wp-content\/uploads\/2026\/08\/wp-query-category-filter-not-working-SC-01.png\" alt=\"\u533f\u540d\u306e\u691c\u8a3c\u74b0\u5883\u3067\u30ab\u30c6\u30b4\u30ea\u30fc\u306e\u540d\u524d\u3001\u30b9\u30e9\u30c3\u30b0\u3001ID\u3092\u78ba\u8a8d\u3057\u3066\u3044\u308b\u753b\u9762\" loading=\"lazy\" \/><\/span><figcaption class=\"wpq-screenshot-frame__caption\"><span class=\"wpq-screenshot-frame__eyebrow\">\u7ba1\u7406\u753b\u9762\u3067\u78ba\u8a8d<\/span><strong class=\"wpq-screenshot-frame__title\">\u540d\u524d\u30fb\u30b9\u30e9\u30c3\u30b0\u30fbID\u306f\u5225\u306e\u5024<\/strong><p class=\"wpq-screenshot-frame__caption-text\">category_name\u306b\u306f\u300c\u30b9\u30e9\u30c3\u30b0\u300d\u5217\u3001cat\u3084category__in\u306b\u306f\u300cID\u300d\u5217\u306e\u5024\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p><\/figcaption><\/figure>\n<h3 id=\"children\" class=\"wpq-subheading\">\u539f\u56e02: \u5b50\u30ab\u30c6\u30b4\u30ea\u3092\u542b\u3080\u304b\u3069\u3046\u304b\u3092\u8aa4\u89e3\u3057\u3066\u3044\u308b<\/h3>\n<p>\u516c\u5f0f\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u3067\u306f\u3001`cat`\u3084`category_name`\u306f\u5b50\u30ab\u30c6\u30b4\u30ea\u3082\u5bfe\u8c61\u306b\u542b\u3080\u6307\u5b9a\u3068\u3057\u3066\u8aac\u660e\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u4e00\u65b9\u3001`category__in`\u306f\u6307\u5b9a\u3057\u305f\u30ab\u30c6\u30b4\u30eaID\u305d\u306e\u3082\u306e\u3092\u5bfe\u8c61\u306b\u3057\u3001\u5b50\u30ab\u30c6\u30b4\u30ea\u3092\u81ea\u52d5\u3067\u306f\u542b\u3081\u307e\u305b\u3093\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u300c\u89aa\u30ab\u30c6\u30b4\u30ea\u3060\u3051\u3092\u6307\u5b9a\u3057\u305f\u306e\u306b\u5b50\u30ab\u30c6\u30b4\u30ea\u306e\u8a18\u4e8b\u3082\u51fa\u308b\u300d\u5834\u5408\u306f `cat` \u3084 `category_name` \u306e\u52d5\u304d\u3092\u7591\u3044\u307e\u3059\u3002\u9006\u306b\u3001\u300c\u89aa\u30ab\u30c6\u30b4\u30ea\u3092\u6307\u5b9a\u3057\u305f\u306e\u306b\u5b50\u30ab\u30c6\u30b4\u30ea\u306e\u8a18\u4e8b\u304c\u51fa\u306a\u3044\u300d\u5834\u5408\u306f `category__in` \u3092\u4f7f\u3063\u3066\u3044\u306a\u3044\u304b\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<h3 id=\"taxonomy-mismatch\" class=\"wpq-subheading\">\u539f\u56e03: \u30ab\u30c6\u30b4\u30ea\u30fc\u3067\u306f\u306a\u304f\u30ab\u30b9\u30bf\u30e0\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u3092\u7d5e\u308a\u8fbc\u3082\u3046\u3068\u3057\u3066\u3044\u308b<\/h3>\n<p>\u901a\u5e38\u306e\u6295\u7a3f\u30ab\u30c6\u30b4\u30ea\u30fc\u306f `category` \u30bf\u30af\u30bd\u30ce\u30df\u30fc\u3067\u3059\u3002\u3057\u304b\u3057\u3001\u5546\u54c1\u30b8\u30e3\u30f3\u30eb\u3001\u5236\u4f5c\u5b9f\u7e3e\u306e\u7a2e\u985e\u3001\u30a4\u30d9\u30f3\u30c8\u5730\u57df\u306a\u3069\u3092\u72ec\u81ea\u306b\u4f5c\u3063\u3066\u3044\u308b\u5834\u5408\u3001\u305d\u308c\u306f\u30ab\u30b9\u30bf\u30e0\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u30ab\u30b9\u30bf\u30e0\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u3092\u901a\u5e38\u306e `cat` \u3084 `category_name` \u3067\u7d5e\u308a\u8fbc\u3082\u3046\u3068\u3057\u3066\u3082\u3001\u610f\u56f3\u3057\u305f\u7d50\u679c\u306b\u306a\u308a\u307e\u305b\u3093\u3002\u305d\u306e\u5834\u5408\u306f `tax_query` \u3067 `taxonomy`\u3001`field`\u3001`terms` \u3092\u660e\u793a\u3057\u307e\u3059\u3002<\/p>\n<h3 id=\"too-many-conditions\" class=\"wpq-subheading\">\u539f\u56e04: \u30ab\u30c6\u30b4\u30ea\u4ee5\u5916\u306e\u6761\u4ef6\u30670\u4ef6\u306b\u306a\u3063\u3066\u3044\u308b<\/h3>\n<p>\u30ab\u30c6\u30b4\u30ea\u6307\u5b9a\u3060\u3051\u306f\u6b63\u3057\u304f\u3066\u3082\u3001`post_type`\u3001`post_status`\u3001`meta_query`\u3001`tax_query` \u306e\u5225\u6761\u4ef6\u3001\u691c\u7d22\u30ad\u30fc\u30ef\u30fc\u30c9\u3001\u65e5\u4ed8\u6761\u4ef6\u306a\u3069\u304c\u540c\u6642\u306b\u5165\u3063\u3066\u3044\u308b\u3068\u3001\u7d50\u679c\u304c0\u4ef6\u306b\u306a\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u7279\u306b\u3001\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u3092\u5bfe\u8c61\u306b\u3057\u3066\u3044\u308b\u306e\u306b`post_type`\u304c`post`\u306e\u307e\u307e\u306a\u3089\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3002\u30ab\u30c6\u30b4\u30ea\u4ee5\u5916\u306e\u6761\u4ef6\u3092\u5916\u3057\u3066\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<h2 id=\"minimal-test\" class=\"h-underline section-heading\"><span class=\"section-heading-icon\" aria-hidden=\"true\"><svg data-wpq-icon=\"code\" aria-hidden=\"true\" focusable=\"false\" class=\"wpq-icon-svg\"\n  xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n \n \n  viewBox=\"0 0 24 24\"\n  fill=\"none\"\n  stroke=\"currentColor\"\n  stroke-width=\"2\"\n  stroke-linecap=\"round\"\n  stroke-linejoin=\"round\"\n>\n  <path d=\"m18 16 4-4-4-4\" \/>\n  <path d=\"m6 8-4 4 4 4\" \/>\n  <path d=\"m14.5 4-5 16\" \/>\n<\/svg><\/span><span class=\"section-heading-text\">\u307e\u305a\u8a66\u3059\u6700\u5c0f\u4f8b<\/span><\/h2>\n<p>\u3053\u3053\u3067\u306f\u3001\u901a\u5e38\u306e\u6295\u7a3f\u30ab\u30c6\u30b4\u30ea\u30fc\u3092slug\u3067\u7d5e\u308a\u8fbc\u3080\u6700\u5c0f\u4f8b\u3092\u4f7f\u3044\u307e\u3059\u3002\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\u5185\u3067\u300c\u3053\u306e\u30ab\u30c6\u30b4\u30ea\u3060\u3051\u53d6\u308c\u308b\u304b\u300d\u3092\u898b\u308b\u305f\u3081\u306e\u78ba\u8a8d\u30b3\u30fc\u30c9\u3067\u3059\u3002`news` \u306f\u30b5\u30f3\u30d7\u30eb\u306a\u306e\u3067\u3001\u5b9f\u969b\u306e\u30ab\u30c6\u30b4\u30easlug\u306b\u7f6e\u304d\u63db\u3048\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3053\u306e\u6bb5\u968e\u3067\u306f\u3001`meta_query` \u3084\u8907\u6570\u30ab\u30c6\u30b4\u30ea\u6761\u4ef6\u3092\u8db3\u3055\u306a\u3044\u3067\u304f\u3060\u3055\u3044\u3002\u307e\u305a\u306f1\u3064\u306e\u30ab\u30c6\u30b4\u30ea\u3060\u3051\u3067\u53d6\u5f97\u3067\u304d\u308b\u304b\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<div class=\"code-panel wpq-code-block\"><div class=\"wpq-code-context wpq-code-context--temporary\"><span class=\"wpq-code-context__icon\" aria-hidden=\"true\"><svg data-wpq-icon=\"folder-open\" aria-hidden=\"true\" focusable=\"false\" class=\"wpq-icon-svg\"\n  xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n \n \n  viewBox=\"0 0 24 24\"\n  fill=\"none\"\n  stroke=\"currentColor\"\n  stroke-width=\"2\"\n  stroke-linecap=\"round\"\n  stroke-linejoin=\"round\"\n>\n  <path d=\"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2\" \/>\n<\/svg><\/span><p>\u539f\u56e0\u3092\u5207\u308a\u5206\u3051\u308b\u305f\u3081\u306e\u4e00\u6642\u7684\u306a\u78ba\u8a8d\u30b3\u30fc\u30c9\u3067\u3059\u3002\u30ed\u30fc\u30ab\u30eb\u306a\u3069\u306e\u691c\u8a3c\u74b0\u5883\u3060\u3051\u3067\u4f7f\u3044\u3001\u78ba\u8a8d\u5f8c\u306f\u524a\u9664\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p><\/div><div class=\"code-head wpq-code-head\"><div class=\"code-meta wpq-code-meta\"><span class=\"code-lang wpq-code-pill wpq-code-pill--lang\">PHP<\/span><span class=\"code-filename wpq-code-pill\">category-check.php<\/span><span class=\"code-purpose wpq-code-pill\">\u30ab\u30c6\u30b4\u30easlug\u3067\u6295\u7a3f\u3092\u7d5e\u308a\u8fbc\u3081\u308b\u304b\u78ba\u8a8d\u3059\u308b\u6700\u5c0f\u4f8b<\/span><\/div><button type=\"button\" class=\"copy-button wpq-copy-button\">\u30b3\u30d4\u30fc<\/button><\/div><pre data-wpq-code-region data-wpq-code-label=\"\u30b3\u30fc\u30c9\u4f8b: \u30ab\u30c6\u30b4\u30easlug\u3067\u6295\u7a3f\u3092\u7d5e\u308a\u8fbc\u3081\u308b\u304b\u78ba\u8a8d\u3059\u308b\u6700\u5c0f\u4f8b \/ category-check.php \/ PHP\"><code><span class=\"wpq-code-line\">&lt;br \/&gt;<\/span><span class=\"wpq-code-line\"><span class=\"c-var\">$args<\/span> = [&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">   <span class=\"c-key\">&#039;post_type&#039;<\/span>      =&gt; <span class=\"c-str\">&#039;post&#039;<\/span>,&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">   <span class=\"c-key\">&#039;posts_per_page&#039;<\/span> =&gt; <span class=\"c-num\">5<\/span>,&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">   <span class=\"c-key\">&#039;category_name&#039;<\/span>  =&gt; <span class=\"c-str\">&#039;news&#039;<\/span>,&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">];&lt;\/p&gt;<\/span><span class=\"wpq-code-line\">&lt;p&gt;<span class=\"c-var\">$category_query<\/span> = <span class=\"c-keyword\">new<\/span> <span class=\"c-fn\">WP_Query<\/span>( <span class=\"c-var\">$args<\/span> );&lt;\/p&gt;<\/span><span class=\"wpq-code-line\">&lt;p&gt;<span class=\"c-keyword\">if<\/span> ( <span class=\"c-var\">$category_query<\/span>-&gt;have_posts() ) {&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">   <span class=\"c-keyword\">while<\/span> ( <span class=\"c-var\">$category_query<\/span>-&gt;have_posts() ) {&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">      <span class=\"c-var\">$category_query<\/span>-&gt;the_post();&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">      <span class=\"c-keyword\">echo<\/span> esc_html( get_the_title() ) . <span class=\"c-str\">&#039;&lt;br&gt;&#039;<\/span>;&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">   }&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">   wp_reset_postdata();&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">} <span class=\"c-keyword\">else<\/span> {&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">   <span class=\"c-keyword\">echo<\/span> <span class=\"c-str\">&#039;\u6307\u5b9a\u3057\u305f\u30ab\u30c6\u30b4\u30ea\u306e\u6295\u7a3f\u306f\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002&#039;<\/span>;&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">}&lt;br \/&gt;<\/span><\/code><\/pre><textarea class=\"wpq-code-raw\" hidden aria-hidden=\"true\" tabindex=\"-1\">&lt;br \/&gt;\n$args = [&lt;br \/&gt;\n   &#039;post_type&#039;      =&gt; &#039;post&#039;,&lt;br \/&gt;\n   &#039;posts_per_page&#039; =&gt; 5,&lt;br \/&gt;\n   &#039;category_name&#039;  =&gt; &#039;news&#039;,&lt;br \/&gt;\n];&lt;\/p&gt;\n&lt;p&gt;$category_query = new WP_Query( $args );&lt;\/p&gt;\n&lt;p&gt;if ( $category_query-&gt;have_posts() ) {&lt;br \/&gt;\n   while ( $category_query-&gt;have_posts() ) {&lt;br \/&gt;\n      $category_query-&gt;the_post();&lt;br \/&gt;\n      echo esc_html( get_the_title() ) . &#039;&lt;br&gt;&#039;;&lt;br \/&gt;\n   }&lt;br \/&gt;\n   wp_reset_postdata();&lt;br \/&gt;\n} else {&lt;br \/&gt;\n   echo &#039;\u6307\u5b9a\u3057\u305f\u30ab\u30c6\u30b4\u30ea\u306e\u6295\u7a3f\u306f\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002&#039;;&lt;br \/&gt;\n}&lt;br \/&gt;<\/textarea><\/div>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u306e\u30dd\u30a4\u30f3\u30c8\u306f\u3001`category_name`\u306b\u30ab\u30c6\u30b4\u30ea\u306e\u8868\u793a\u540d\u3067\u306f\u306a\u304fslug\u3092\u5165\u308c\u3066\u3044\u308b\u70b9\u3067\u3059\u3002\u307e\u305f\u3001`posts_per_page`\u3092\u5c0f\u3055\u304f\u3057\u3066\u3001\u6761\u4ef6\u304c\u52b9\u3044\u3066\u3044\u308b\u304b\u3092\u78ba\u8a8d\u3057\u3084\u3059\u304f\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u6700\u5c0f\u4f8b\u3067\u6295\u7a3f\u304c\u51fa\u308b\u306a\u3089\u3001\u30ab\u30c6\u30b4\u30easlug\u81ea\u4f53\u306f\u5408\u3063\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u9ad8\u3044\u3067\u3059\u3002\u6b21\u306f\u3001\u5143\u306e\u30b3\u30fc\u30c9\u306b\u623b\u3057\u3066\u3001\u8ffd\u52a0\u3057\u3066\u3044\u308b\u6761\u4ef6\u306e\u3069\u308c\u304c\u7d50\u679c\u3092\u5909\u3048\u3066\u3044\u308b\u304b\u30921\u3064\u305a\u3064\u623b\u3057\u307e\u3059\u3002<\/p>\n<h2 id=\"fix-by-pattern\" class=\"h-underline section-heading\"><span class=\"section-heading-icon\" aria-hidden=\"true\"><svg data-wpq-icon=\"binder-check\" aria-hidden=\"true\" focusable=\"false\" class=\"wpq-icon-svg\"\n  xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n \n \n  viewBox=\"0 0 24 24\"\n  fill=\"none\"\n  stroke=\"currentColor\"\n  stroke-width=\"2\"\n  stroke-linecap=\"round\"\n  stroke-linejoin=\"round\"\n>\n  <rect width=\"8\" height=\"4\" x=\"8\" y=\"2\" rx=\"1\" ry=\"1\" \/>\n  <path d=\"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2\" \/>\n  <path d=\"m9 14 2 2 4-4\" \/>\n<\/svg><\/span><span class=\"section-heading-text\">\u539f\u56e0\u5225\u306e\u5bfe\u51e6\u6cd5<\/span><\/h2>\n<p>\u540c\u3058\u300c\u30ab\u30c6\u30b4\u30ea\u7d5e\u308a\u8fbc\u307f\u300d\u3068\u8a00\u3063\u3066\u3082\u3001ID\u3067\u6307\u5b9a\u3057\u305f\u3044\u306e\u304b\u3001slug\u3067\u6307\u5b9a\u3057\u305f\u3044\u306e\u304b\u3001\u5b50\u30ab\u30c6\u30b4\u30ea\u3092\u542b\u3081\u305f\u3044\u306e\u304b\u3067\u9078\u3076\u5f15\u6570\u304c\u5909\u308f\u308a\u307e\u3059\u3002<\/p>\n<h3 id=\"use-id-or-slug\" class=\"wpq-subheading\">ID\u3067\u6307\u5b9a\u3059\u308b\u304b\u3001slug\u3067\u6307\u5b9a\u3059\u308b\u304b\u3092\u6c7a\u3081\u308b<\/h3>\n<p>\u30ab\u30c6\u30b4\u30eaID\u3067\u7d5e\u308a\u8fbc\u3080\u306a\u3089 `cat` \u307e\u305f\u306f `category__in` \u3092\u4f7f\u3044\u307e\u3059\u3002slug\u3067\u7d5e\u308a\u8fbc\u3080\u306a\u3089 `category_name` \u304c\u5206\u304b\u308a\u3084\u3059\u3044\u3067\u3059\u3002<\/p>\n<div class=\"wpq-table-block\"><p class=\"wpq-table-hint\" aria-hidden=\"true\">\u8868\u306f\u6a2a\u306b\u30b9\u30af\u30ed\u30fc\u30eb\u3067\u304d\u307e\u3059<\/p><div class=\"cause-table table-scroll wpq-table-wrap\" role=\"region\" tabindex=\"0\" aria-label=\"\u8868: \u3084\u308a\u305f\u3044\u3053\u3068 \/ \u4f7f\u3046\u5f15\u6570 \/ \u6307\u5b9a\u3059\u308b\u5024\"><table class=\"article-table table-priority wpq-article-table\"><thead><tr><th>\u3084\u308a\u305f\u3044\u3053\u3068<\/th><th>\u4f7f\u3046\u5f15\u6570<\/th><th>\u6307\u5b9a\u3059\u308b\u5024<\/th><\/tr><\/thead><tbody><tr><td>\u30ab\u30c6\u30b4\u30eaID 4 \u306e\u6295\u7a3f\u3092\u51fa\u3059<\/td><td><code>cat<\/code><\/td><td><code>4<\/code><\/td><\/tr><tr><td>slug \u304c news \u306e\u6295\u7a3f\u3092\u51fa\u3059<\/td><td><code>category_name<\/code><\/td><td><code>news<\/code><\/td><\/tr><tr><td>ID 2 \u307e\u305f\u306f 6 \u306e\u6295\u7a3f\u3092\u51fa\u3059<\/td><td><code>category__in<\/code><\/td><td><code>array( 2, 6 )<\/code><\/td><\/tr><tr><td>ID 2 \u3068 6 \u306e\u4e21\u65b9\u306b\u5c5e\u3059\u308b\u6295\u7a3f\u3092\u51fa\u3059<\/td><td><code>category__and<\/code><\/td><td><code>array( 2, 6 )<\/code><\/td><\/tr><tr><td>\u30ab\u30c6\u30b4\u30eaID 2 \u3068 6 \u3092\u9664\u5916\u3059\u308b<\/td><td><code>category__not_in<\/code><\/td><td><code>array( 2, 6 )<\/code><\/td><\/tr><\/tbody><\/table><\/div><\/div>\n<p>`category__and` \u306f\u300c\u3069\u3061\u3089\u304b\u300d\u3067\u306f\u306a\u304f\u300c\u4e21\u65b9\u300d\u3067\u3059\u3002\u3053\u3053\u3092\u52d8\u9055\u3044\u3059\u308b\u3068\u3001\u6295\u7a3f\u304c\u6025\u306b\u5c11\u306a\u304f\u306a\u3063\u305f\u308a\u30010\u4ef6\u306b\u306a\u3063\u305f\u308a\u3057\u307e\u3059\u3002\u8907\u6570\u30ab\u30c6\u30b4\u30ea\u306e\u6761\u4ef6\u3067\u306f\u3001\u307e\u305a OR \u306a\u306e\u304b AND \u306a\u306e\u304b\u3092\u8a00\u8449\u3067\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>`category_name`\u3067\u3082\u8907\u6570\u306eslug\u3092\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002`news,events`\u306f\u3069\u3061\u3089\u304b\u306e\u30ab\u30c6\u30b4\u30ea\u30fc\u3001`news+events`\u306f\u4e21\u65b9\u306e\u30ab\u30c6\u30b4\u30ea\u30fc\u306b\u5c5e\u3059\u308b\u6295\u7a3f\u304c\u5bfe\u8c61\u3067\u3059\u3002\u6761\u4ef6\u304c\u5897\u3048\u3066\u8aad\u307f\u3065\u3089\u304f\u306a\u308b\u5834\u5408\u3084\u3001\u5b50\u30ab\u30c6\u30b4\u30ea\u30fc\u3092\u542b\u3081\u308b\u7bc4\u56f2\u307e\u3067\u660e\u793a\u3057\u305f\u3044\u5834\u5408\u306f\u3001`category__in`\u3084`category__and`\u3001\u307e\u305f\u306f`tax_query`\u3092\u4f7f\u3046\u3068\u610f\u56f3\u3092\u8ffd\u3044\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3 id=\"use-tax-query\" class=\"wpq-subheading\">tax_query\u3067\u30ab\u30c6\u30b4\u30ea\u30fc\u3092\u6307\u5b9a\u3059\u308b<\/h3>\n<p>\u8907\u6570\u6761\u4ef6\u306b\u767a\u5c55\u3057\u305d\u3046\u306a\u5834\u5408\u3084\u3001\u30ab\u30c6\u30b4\u30ea\u30fc\u4ee5\u5916\u306e\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u3082\u4e00\u7dd2\u306b\u6271\u3046\u5834\u5408\u306f\u3001`tax_query` \u3067\u66f8\u304f\u3068\u610f\u56f3\u3092\u660e\u793a\u3057\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306e\u30b3\u30fc\u30c9\u306f\u3001\u901a\u5e38\u306e\u30ab\u30c6\u30b4\u30ea\u30fc\u3092 `tax_query` \u3067\u7d5e\u308a\u8fbc\u3080\u4f8b\u3067\u3059\u3002`taxonomy` \u306b `category`\u3001`field` \u306b `slug`\u3001`terms` \u306b\u30ab\u30c6\u30b4\u30easlug\u3092\u6307\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<div class=\"code-panel wpq-code-block\"><div class=\"wpq-code-context wpq-code-context--template\"><span class=\"wpq-code-context__icon\" aria-hidden=\"true\"><svg data-wpq-icon=\"folder-open\" aria-hidden=\"true\" focusable=\"false\" class=\"wpq-icon-svg\"\n  xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n \n \n  viewBox=\"0 0 24 24\"\n  fill=\"none\"\n  stroke=\"currentColor\"\n  stroke-width=\"2\"\n  stroke-linecap=\"round\"\n  stroke-linejoin=\"round\"\n>\n  <path d=\"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2\" \/>\n<\/svg><\/span><p>\u30af\u30e9\u30b7\u30c3\u30af\u30c6\u30fc\u30de\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\uff08\u307e\u305f\u306f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30d1\u30fc\u30c4\uff09\u3067\u3001\u4e00\u89a7\u3092\u8868\u793a\u3057\u305f\u3044\u4f4d\u7f6e\u306b\u7f6e\u304f\u4f8b\u3067\u3059\u3002\u6295\u7a3f\u672c\u6587\u3084functions.php\u3078\u3001\u305d\u306e\u307e\u307e\u8cbc\u308b\u30b3\u30fc\u30c9\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p><\/div><div class=\"code-head wpq-code-head\"><div class=\"code-meta wpq-code-meta\"><span class=\"code-lang wpq-code-pill wpq-code-pill--lang\">PHP<\/span><span class=\"code-filename wpq-code-pill\">category-tax-query.php<\/span><span class=\"code-purpose wpq-code-pill\">tax_query\u3067\u901a\u5e38\u306e\u30ab\u30c6\u30b4\u30ea\u30fc\u3092slug\u6307\u5b9a\u3059\u308b\u4f8b<\/span><\/div><button type=\"button\" class=\"copy-button wpq-copy-button\">\u30b3\u30d4\u30fc<\/button><\/div><pre data-wpq-code-region data-wpq-code-label=\"\u30b3\u30fc\u30c9\u4f8b: tax_query\u3067\u901a\u5e38\u306e\u30ab\u30c6\u30b4\u30ea\u30fc\u3092slug\u6307\u5b9a\u3059\u308b\u4f8b \/ category-tax-query.php \/ PHP\"><code><span class=\"wpq-code-line\">&lt;br \/&gt;<\/span><span class=\"wpq-code-line\"><span class=\"c-var\">$args<\/span> = [&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">   <span class=\"c-key\">&#039;post_type&#039;<\/span>      =&gt; <span class=\"c-str\">&#039;post&#039;<\/span>,&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">   <span class=\"c-key\">&#039;posts_per_page&#039;<\/span> =&gt; <span class=\"c-num\">5<\/span>,&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">   <span class=\"c-key\">&#039;tax_query&#039;<\/span>      =&gt; [&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">      [&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">         <span class=\"c-key\">&#039;taxonomy&#039;<\/span> =&gt; <span class=\"c-str\">&#039;category&#039;<\/span>,&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">         <span class=\"c-key\">&#039;field&#039;<\/span>    =&gt; <span class=\"c-str\">&#039;slug&#039;<\/span>,&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">         <span class=\"c-key\">&#039;terms&#039;<\/span>    =&gt; [ <span class=\"c-str\">&#039;news&#039;<\/span> ],&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">         <span class=\"c-key\">&#039;operator&#039;<\/span> =&gt; <span class=\"c-str\">&#039;IN&#039;<\/span>,&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">         <span class=\"c-key\">&#039;include_children&#039;<\/span> =&gt; <span class=\"c-keyword\">false<\/span>,&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">      ],&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">   ],&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">];&lt;\/p&gt;<\/span><span class=\"wpq-code-line\">&lt;p&gt;<span class=\"c-var\">$category_query<\/span> = <span class=\"c-keyword\">new<\/span> <span class=\"c-fn\">WP_Query<\/span>( <span class=\"c-var\">$args<\/span> );&lt;br \/&gt;<\/span><\/code><\/pre><textarea class=\"wpq-code-raw\" hidden aria-hidden=\"true\" tabindex=\"-1\">&lt;br \/&gt;\n$args = [&lt;br \/&gt;\n   &#039;post_type&#039;      =&gt; &#039;post&#039;,&lt;br \/&gt;\n   &#039;posts_per_page&#039; =&gt; 5,&lt;br \/&gt;\n   &#039;tax_query&#039;      =&gt; [&lt;br \/&gt;\n      [&lt;br \/&gt;\n         &#039;taxonomy&#039; =&gt; &#039;category&#039;,&lt;br \/&gt;\n         &#039;field&#039;    =&gt; &#039;slug&#039;,&lt;br \/&gt;\n         &#039;terms&#039;    =&gt; [ &#039;news&#039; ],&lt;br \/&gt;\n         &#039;operator&#039; =&gt; &#039;IN&#039;,&lt;br \/&gt;\n         &#039;include_children&#039; =&gt; false,&lt;br \/&gt;\n      ],&lt;br \/&gt;\n   ],&lt;br \/&gt;\n];&lt;\/p&gt;\n&lt;p&gt;$category_query = new WP_Query( $args );&lt;br \/&gt;<\/textarea><\/div>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u306e\u30dd\u30a4\u30f3\u30c8\u306f\u3001`taxonomy`\u3068`field`\u306b\u52a0\u3048\u3001`operator`\u3068`include_children`\u3082\u660e\u793a\u3057\u3066\u3044\u308b\u70b9\u3067\u3059\u3002`operator =&gt; &#8216;IN&#8217;`\u306f\u6307\u5b9a\u30bf\u30fc\u30e0\u306e\u3044\u305a\u308c\u304b\u306b\u5c5e\u3059\u308b\u6295\u7a3f\u3001`include_children =&gt; false`\u306f\u5b50\u30bf\u30fc\u30e0\u3092\u81ea\u52d5\u3067\u542b\u3081\u306a\u3044\u6307\u5b9a\u3067\u3059\u3002`tax_query`\u306e`include_children`\u306f\u65e2\u5b9a\u3067`true`\u306a\u306e\u3067\u3001\u89aa\u3060\u3051\u306b\u9650\u5b9a\u3057\u305f\u3044\u6642\u306f\u610f\u56f3\u3092\u30b3\u30fc\u30c9\u306b\u6b8b\u3057\u307e\u3059\u3002<\/p>\n<p>slug\u306b\u81ea\u4fe1\u304c\u306a\u3044\u5834\u5408\u306f\u3001\u7ba1\u7406\u753b\u9762\u306e\u30ab\u30c6\u30b4\u30ea\u30fc\u4e00\u89a7\u3001`get_category_by_slug()`\u3001`get_term_by()`\u306e\u3044\u305a\u308c\u304b\u3067\u3001\u5bfe\u8c61\u30bf\u30fc\u30e0\u304c\u5b58\u5728\u3059\u308b\u304b\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<h3 id=\"custom-post-type\" class=\"wpq-subheading\">\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u3067\u30ab\u30c6\u30b4\u30ea\u304c\u51fa\u306a\u3044\u5834\u5408<\/h3>\n<p>\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3067\u901a\u5e38\u306e\u30ab\u30c6\u30b4\u30ea\u30fc\u3092\u4f7f\u3044\u305f\u3044\u5834\u5408\u3001\u305d\u306e\u6295\u7a3f\u30bf\u30a4\u30d7\u304c`category`\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002`register_post_type()`\u306e`taxonomies`\u3001\u307e\u305f\u306f`register_taxonomy_for_object_type()`\u3067\u95a2\u9023\u4ed8\u3051\u3089\u308c\u3066\u3044\u306a\u3044\u3068\u3001\u7ba1\u7406\u753b\u9762\u3067\u30ab\u30c6\u30b4\u30ea\u3092\u4ed8\u3051\u3089\u308c\u305a\u3001\u30af\u30a8\u30ea\u6761\u4ef6\u3060\u3051\u76f4\u3057\u3066\u3082\u5bfe\u8c61\u6295\u7a3f\u306f\u5897\u3048\u307e\u305b\u3093\u3002<\/p>\n<span class=\"wpq-marker wpq-marker--yellow\">WP_Query\u5074\u3067\u3082`post_type`\u3092\u5bfe\u8c61\u306e\u6295\u7a3f\u30bf\u30a4\u30d7\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u901a\u5e38\u6295\u7a3f\u3060\u3051\u3092\u5bfe\u8c61\u306b\u3057\u305f\u307e\u307e\u3067\u306f\u3001\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u306f\u691c\u7d22\u5bfe\u8c61\u306b\u5165\u308a\u307e\u305b\u3093\u3002<\/span>\n<div class=\"code-panel wpq-code-block\"><div class=\"wpq-code-context wpq-code-context--temporary\"><span class=\"wpq-code-context__icon\" aria-hidden=\"true\"><svg data-wpq-icon=\"folder-open\" aria-hidden=\"true\" focusable=\"false\" class=\"wpq-icon-svg\"\n  xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n \n \n  viewBox=\"0 0 24 24\"\n  fill=\"none\"\n  stroke=\"currentColor\"\n  stroke-width=\"2\"\n  stroke-linecap=\"round\"\n  stroke-linejoin=\"round\"\n>\n  <path d=\"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2\" \/>\n<\/svg><\/span><p>\u539f\u56e0\u3092\u5207\u308a\u5206\u3051\u308b\u305f\u3081\u306e\u4e00\u6642\u7684\u306a\u78ba\u8a8d\u30b3\u30fc\u30c9\u3067\u3059\u3002\u30ed\u30fc\u30ab\u30eb\u306a\u3069\u306e\u691c\u8a3c\u74b0\u5883\u3060\u3051\u3067\u4f7f\u3044\u3001\u78ba\u8a8d\u5f8c\u306f\u524a\u9664\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p><\/div><div class=\"code-head wpq-code-head\"><div class=\"code-meta wpq-code-meta\"><span class=\"code-lang wpq-code-pill wpq-code-pill--lang\">PHP<\/span><span class=\"code-filename wpq-code-pill\">custom-post-category-check.php<\/span><span class=\"code-purpose wpq-code-pill\">\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3067\u30ab\u30c6\u30b4\u30ea\u30fc\u3092\u7d5e\u308a\u8fbc\u3080\u78ba\u8a8d\u4f8b<\/span><\/div><button type=\"button\" class=\"copy-button wpq-copy-button\">\u30b3\u30d4\u30fc<\/button><\/div><pre data-wpq-code-region data-wpq-code-label=\"\u30b3\u30fc\u30c9\u4f8b: \u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3067\u30ab\u30c6\u30b4\u30ea\u30fc\u3092\u7d5e\u308a\u8fbc\u3080\u78ba\u8a8d\u4f8b \/ custom-post-category-check.php \/ PHP\"><code><span class=\"wpq-code-line\">&lt;br \/&gt;<\/span><span class=\"wpq-code-line\"><span class=\"c-var\">$args<\/span> = [&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">   <span class=\"c-key\">&#039;post_type&#039;<\/span>      =&gt; <span class=\"c-str\">&#039;works&#039;<\/span>,&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">   <span class=\"c-key\">&#039;posts_per_page&#039;<\/span> =&gt; <span class=\"c-num\">5<\/span>,&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">   <span class=\"c-key\">&#039;category_name&#039;<\/span>  =&gt; <span class=\"c-str\">&#039;news&#039;<\/span>,&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">];&lt;\/p&gt;<\/span><span class=\"wpq-code-line\">&lt;p&gt;<span class=\"c-var\">$works_query<\/span> = <span class=\"c-keyword\">new<\/span> <span class=\"c-fn\">WP_Query<\/span>( <span class=\"c-var\">$args<\/span> );&lt;br \/&gt;<\/span><\/code><\/pre><textarea class=\"wpq-code-raw\" hidden aria-hidden=\"true\" tabindex=\"-1\">&lt;br \/&gt;\n$args = [&lt;br \/&gt;\n   &#039;post_type&#039;      =&gt; &#039;works&#039;,&lt;br \/&gt;\n   &#039;posts_per_page&#039; =&gt; 5,&lt;br \/&gt;\n   &#039;category_name&#039;  =&gt; &#039;news&#039;,&lt;br \/&gt;\n];&lt;\/p&gt;\n&lt;p&gt;$works_query = new WP_Query( $args );&lt;br \/&gt;<\/textarea><\/div>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u306e\u30dd\u30a4\u30f3\u30c8\u306f\u3001`post_type`\u3092`works`\u306b\u5909\u3048\u3066\u3044\u308b\u70b9\u3067\u3059\u3002\u305f\u3060\u3057\u3001\u3053\u308c\u306f\u6295\u7a3f\u30bf\u30a4\u30d7`works`\u304c\u901a\u5e38\u306e\u30ab\u30c6\u30b4\u30ea\u30fc\u3092\u4f7f\u3048\u308b\u524d\u63d0\u306e\u4f8b\u3067\u3059\u3002\u5bfe\u8c61\u6295\u7a3fID\u306b`wp_get_post_terms( $post_id, &#8216;category&#8217; )`\u3092\u4f7f\u3044\u3001\u5b9f\u969b\u306b\u30ab\u30c6\u30b4\u30ea\u304c\u5272\u308a\u5f53\u3066\u3089\u308c\u3066\u3044\u308b\u304b\u3082\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2 id=\"check-order\" class=\"h-underline section-heading\"><span class=\"section-heading-icon\" aria-hidden=\"true\"><svg data-wpq-icon=\"map\" aria-hidden=\"true\" focusable=\"false\" class=\"wpq-icon-svg\"\n  xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n \n \n  viewBox=\"0 0 24 24\"\n  fill=\"none\"\n  stroke=\"currentColor\"\n  stroke-width=\"2\"\n  stroke-linecap=\"round\"\n  stroke-linejoin=\"round\"\n>\n  <path d=\"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z\" \/>\n  <path d=\"M15 5.764v15\" \/>\n  <path d=\"M9 3.236v15\" \/>\n<\/svg><\/span><span class=\"section-heading-text\">\u5207\u308a\u5206\u3051\u306e\u9806\u756a<\/span><\/h2>\n<p>\u30ab\u30c6\u30b4\u30ea\u7d5e\u308a\u8fbc\u307f\u304c\u52b9\u304b\u306a\u3044\u3068\u304d\u306f\u3001\u8907\u96d1\u306a\u30b3\u30fc\u30c9\u3092\u4f55\u5ea6\u3082\u66f8\u304d\u63db\u3048\u308b\u3088\u308a\u3001\u6761\u4ef6\u3092\u6e1b\u3089\u3057\u3066\u304b\u30891\u3064\u305a\u3064\u623b\u3059\u65b9\u304c\u539f\u56e0\u3092\u7279\u5b9a\u3057\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002\u7279\u306b`tax_query`\u3001`meta_query`\u3001\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u3001`pre_get_posts`\u304c\u7d61\u3093\u3067\u3044\u308b\u3068\u3001\u3069\u308c\u304c\u539f\u56e0\u304b\u5206\u304b\u308a\u306b\u304f\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306e\u9806\u756a\u3067\u78ba\u8a8d\u3059\u308b\u3068\u3001\u30ab\u30c6\u30b4\u30ea\u6307\u5b9a\u305d\u306e\u3082\u306e\u306e\u554f\u984c\u304b\u3001\u305d\u308c\u4ee5\u5916\u306e\u6761\u4ef6\u306e\u554f\u984c\u304b\u3092\u5206\u3051\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<section class=\"debug-steps wpq-steps-card\"><h2>\u5207\u308a\u5206\u3051\u624b\u9806<\/h2><ol class=\"step-list wpq-steps\"><li><span class=\"step-number wpq-step-no\">1<\/span><div class=\"step-body wpq-step-body\">\u5bfe\u8c61\u30ab\u30c6\u30b4\u30ea\u306eslug\u3068ID\u3092\u7ba1\u7406\u753b\u9762\u3067\u78ba\u8a8d\u3059\u308b<\/div><\/li><li><span class=\"step-number wpq-step-no\">2<\/span><div class=\"step-body wpq-step-body\">\u5bfe\u8c61\u6295\u7a3fID\u306b\u5b9f\u969b\u306e\u30ab\u30c6\u30b4\u30ea\u304c\u5272\u308a\u5f53\u3066\u3089\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3059\u308b<\/div><\/li><li><span class=\"step-number wpq-step-no\">3<\/span><div class=\"step-body wpq-step-body\">`post_type =&gt; post` \u3068 `category_name` \u3060\u3051\u306e\u6700\u5c0f\u4f8b\u3067\u8a66\u3059<\/div><\/li><li><span class=\"step-number wpq-step-no\">4<\/span><div class=\"step-body wpq-step-body\">\u8868\u793a\u3055\u308c\u305f\u3089\u5143\u30b3\u30fc\u30c9\u306e\u6761\u4ef6\u30921\u3064\u305a\u3064\u623b\u3059<\/div><\/li><li><span class=\"step-number wpq-step-no\">5<\/span><div class=\"step-body wpq-step-body\">\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u306a\u3089\u6295\u7a3f\u30bf\u30a4\u30d7\u3068\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u306e\u95a2\u9023\u4ed8\u3051\u3092\u78ba\u8a8d\u3059\u308b<\/div><\/li><li><span class=\"step-number wpq-step-no\">6<\/span><div class=\"step-body wpq-step-body\">tax_query\u3067\u306foperator\u3068include_children\u3092\u8981\u4ef6\u306b\u5408\u308f\u305b\u308b<\/div><\/li><li><span class=\"step-number wpq-step-no\">7<\/span><div class=\"step-body wpq-step-body\">\u30e1\u30a4\u30f3\u30af\u30a8\u30ea\u306a\u3089pre_get_posts\u306e\u6761\u4ef6\u5206\u5c90\u3092\u78ba\u8a8d\u3059\u308b<\/div><\/li><\/ol><\/section>\n<h2 id=\"official-docs\" class=\"h-underline section-heading\"><span class=\"section-heading-icon\" aria-hidden=\"true\"><svg data-wpq-icon=\"book\" aria-hidden=\"true\" focusable=\"false\" class=\"wpq-icon-svg\"\n  xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n \n \n  viewBox=\"0 0 24 24\"\n  fill=\"none\"\n  stroke=\"currentColor\"\n  stroke-width=\"2\"\n  stroke-linecap=\"round\"\n  stroke-linejoin=\"round\"\n>\n  <path d=\"M12 5v16\" \/>\n  <path d=\"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z\" \/>\n<\/svg><\/span><span class=\"section-heading-text\">\u516c\u5f0f\u8cc7\u6599\u3067\u78ba\u8a8d\u3057\u305f\u3044\u30dd\u30a4\u30f3\u30c8<\/span><\/h2>\n<p>\u30ab\u30c6\u30b4\u30ea\u307e\u308f\u308a\u306e\u5f15\u6570\u306f\u3001\u516c\u5f0f\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u306eWP_Query\u30da\u30fc\u30b8\u306b\u307e\u3068\u307e\u3063\u3066\u3044\u307e\u3059\u3002\u7279\u306b`cat`\u3001`category_name`\u3001`category__in`\u3001`category__and`\u3001`category__not_in`\u306e\u9055\u3044\u306f\u3001\u672c\u6587\u3068\u516c\u5f0f\u8cc7\u6599\u3092\u7167\u3089\u3057\u5408\u308f\u305b\u308b\u3068\u5bfe\u8c61\u7bc4\u56f2\u3092\u5224\u65ad\u3057\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>`tax_query` \u3092\u4f7f\u3046\u5834\u5408\u306f\u3001WP_Query\u5185\u306eTaxonomy Parameters\u3068\u3001WP_Tax_Query\u306e\u30da\u30fc\u30b8\u3082\u78ba\u8a8d\u3057\u3066\u304a\u304f\u3068\u3001`field`\u3001`terms`\u3001`operator`\u3001`include_children` \u306e\u610f\u5473\u3092\u8ffd\u3044\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<section class=\"official-docs-card wpq-reference-card wpq-reference-card--official\"><div class=\"official-docs-head\"><span class=\"official-docs-icon\" aria-hidden=\"true\"><svg data-wpq-icon=\"book\" aria-hidden=\"true\" focusable=\"false\" class=\"wpq-icon-svg\"\n  xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n \n \n  viewBox=\"0 0 24 24\"\n  fill=\"none\"\n  stroke=\"currentColor\"\n  stroke-width=\"2\"\n  stroke-linecap=\"round\"\n  stroke-linejoin=\"round\"\n>\n  <path d=\"M12 5v16\" \/>\n  <path d=\"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z\" \/>\n<\/svg><\/span><div><p class=\"eyebrow wpq-eyebrow\">\u516c\u5f0f\u30ea\u30f3\u30af<\/p><h2>\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/h2><\/div><\/div><ul class=\"wpq-reference-list\"><li class=\"wpq-reference-item\"><a class=\"wpq-reference-item__link\" href=\"https:\/\/developer.wordpress.org\/reference\/classes\/wp_query\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span class=\"wpq-reference-item__copy\"><strong class=\"wpq-reference-item__title\">WP_Query<\/strong><span class=\"wpq-reference-item__description\">\u30ab\u30c6\u30b4\u30ea\u30fc\u5f15\u6570\u3001\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u5f15\u6570\u3001\u6a19\u6e96\u30eb\u30fc\u30d7\u3092\u78ba\u8a8d\u3057\u305f\u3044\u6642<\/span><\/span><span class=\"wpq-reference-item__hint\" aria-hidden=\"true\"><svg data-wpq-icon=\"external\" aria-hidden=\"true\" focusable=\"false\" class=\"wpq-icon-svg\"\n  xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n \n \n  viewBox=\"0 0 24 24\"\n  fill=\"none\"\n  stroke=\"currentColor\"\n  stroke-width=\"2\"\n  stroke-linecap=\"round\"\n  stroke-linejoin=\"round\"\n>\n  <path d=\"M15 3h6v6\" \/>\n  <path d=\"M10 14 21 3\" \/>\n  <path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" \/>\n<\/svg><\/span><\/a><\/li><li class=\"wpq-reference-item\"><a class=\"wpq-reference-item__link\" href=\"https:\/\/developer.wordpress.org\/reference\/classes\/wp_tax_query\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span class=\"wpq-reference-item__copy\"><strong class=\"wpq-reference-item__title\">WP_Tax_Query<\/strong><span class=\"wpq-reference-item__description\">tax_query \u306e\u5185\u90e8\u7684\u306a\u6761\u4ef6\u6307\u5b9a\u3092\u78ba\u8a8d\u3057\u305f\u3044\u6642<\/span><\/span><span class=\"wpq-reference-item__hint\" aria-hidden=\"true\"><svg data-wpq-icon=\"external\" aria-hidden=\"true\" focusable=\"false\" class=\"wpq-icon-svg\"\n  xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n \n \n  viewBox=\"0 0 24 24\"\n  fill=\"none\"\n  stroke=\"currentColor\"\n  stroke-width=\"2\"\n  stroke-linecap=\"round\"\n  stroke-linejoin=\"round\"\n>\n  <path d=\"M15 3h6v6\" \/>\n  <path d=\"M10 14 21 3\" \/>\n  <path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" \/>\n<\/svg><\/span><\/a><\/li><li class=\"wpq-reference-item\"><a class=\"wpq-reference-item__link\" href=\"https:\/\/developer.wordpress.org\/reference\/functions\/get_category_by_slug\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span class=\"wpq-reference-item__copy\"><strong class=\"wpq-reference-item__title\">get_category_by_slug()<\/strong><span class=\"wpq-reference-item__description\">\u30ab\u30c6\u30b4\u30easlug\u304b\u3089\u5bfe\u8c61\u30ab\u30c6\u30b4\u30ea\u3092\u78ba\u8a8d\u3057\u305f\u3044\u6642<\/span><\/span><span class=\"wpq-reference-item__hint\" aria-hidden=\"true\"><svg data-wpq-icon=\"external\" aria-hidden=\"true\" focusable=\"false\" class=\"wpq-icon-svg\"\n  xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n \n \n  viewBox=\"0 0 24 24\"\n  fill=\"none\"\n  stroke=\"currentColor\"\n  stroke-width=\"2\"\n  stroke-linecap=\"round\"\n  stroke-linejoin=\"round\"\n>\n  <path d=\"M15 3h6v6\" \/>\n  <path d=\"M10 14 21 3\" \/>\n  <path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" \/>\n<\/svg><\/span><\/a><\/li><li class=\"wpq-reference-item\"><a class=\"wpq-reference-item__link\" href=\"https:\/\/developer.wordpress.org\/reference\/functions\/get_term_by\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span class=\"wpq-reference-item__copy\"><strong class=\"wpq-reference-item__title\">get_term_by()<\/strong><span class=\"wpq-reference-item__description\">\u30bf\u30fc\u30e0\u306eID\u3001slug\u3001\u540d\u524d\u306e\u5bfe\u5fdc\u3092\u78ba\u8a8d\u3057\u305f\u3044\u6642<\/span><\/span><span class=\"wpq-reference-item__hint\" aria-hidden=\"true\"><svg data-wpq-icon=\"external\" aria-hidden=\"true\" focusable=\"false\" class=\"wpq-icon-svg\"\n  xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n \n \n  viewBox=\"0 0 24 24\"\n  fill=\"none\"\n  stroke=\"currentColor\"\n  stroke-width=\"2\"\n  stroke-linecap=\"round\"\n  stroke-linejoin=\"round\"\n>\n  <path d=\"M15 3h6v6\" \/>\n  <path d=\"M10 14 21 3\" \/>\n  <path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" \/>\n<\/svg><\/span><\/a><\/li><\/ul><\/section>\n<h2 id=\"final-check\" class=\"h-underline section-heading\"><span class=\"section-heading-icon\" aria-hidden=\"true\"><svg data-wpq-icon=\"check\" aria-hidden=\"true\" focusable=\"false\" class=\"wpq-icon-svg\"\n  xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n \n \n  viewBox=\"0 0 24 24\"\n  fill=\"none\"\n  stroke=\"currentColor\"\n  stroke-width=\"2\"\n  stroke-linecap=\"round\"\n  stroke-linejoin=\"round\"\n>\n  <path d=\"M20 6 9 17l-5-5\" \/>\n<\/svg><\/span><span class=\"section-heading-text\">\u6700\u5f8c\u306e\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8<\/span><\/h2>\n<p>ID\u3068slug\u3001\u5b50\u30ab\u30c6\u30b4\u30ea\u3001\u30ab\u30b9\u30bf\u30e0\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u3092\u78ba\u8a8d\u3057\u3066\u3082\u7d50\u679c\u304c\u9055\u3046\u5834\u5408\u306f\u3001\u5225\u306e`tax_query`\u3001`meta_query`\u3001`pre_get_posts`\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u5074\u306e\u30eb\u30fc\u30d7\u30921\u3064\u305a\u3064\u623b\u3057\u307e\u3059\u3002<\/p>\n<section class=\"final-checklist wpq-checklist-card wpq-checklist-card--final\"><div class=\"final-checklist-head\"><span class=\"final-checklist-icon\" aria-hidden=\"true\"><svg data-wpq-icon=\"check\" aria-hidden=\"true\" focusable=\"false\" class=\"wpq-icon-svg\"\n  xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n \n \n  viewBox=\"0 0 24 24\"\n  fill=\"none\"\n  stroke=\"currentColor\"\n  stroke-width=\"2\"\n  stroke-linecap=\"round\"\n  stroke-linejoin=\"round\"\n>\n  <path d=\"M20 6 9 17l-5-5\" \/>\n<\/svg><\/span><h2>\u30ab\u30c6\u30b4\u30ea\u7d5e\u308a\u8fbc\u307f\u306e\u6700\u7d42\u5224\u65ad<\/h2><\/div><ul class=\"wpq-checklist\"><li>\u6a19\u6e96\u30ab\u30c6\u30b4\u30ea\u3068\u30ab\u30b9\u30bf\u30e0\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u3092\u53d6\u308a\u9055\u3048\u3066\u3044\u306a\u3044<\/li><li>ID\u3068slug\u306e\u3069\u3061\u3089\u3092\u6e21\u3059\u5f15\u6570\u304b\u78ba\u8a8d\u3057\u305f<\/li><li>\u5b50\u30ab\u30c6\u30b4\u30ea\u3092\u542b\u3080\u7bc4\u56f2\u304c\u8981\u4ef6\u3068\u5408\u3063\u3066\u3044\u308b<\/li><li>\u4ed6\u306e\u6761\u4ef6\u3092\u623b\u3057\u305f\u5f8c\u3082\u4ef6\u6570\u3068\u5bfe\u8c61\u6295\u7a3f\u3092\u6bd4\u8f03\u3057\u305f<\/li><li>\u30b5\u30d6\u30eb\u30fc\u30d7\u5f8c\u306e\u8868\u793a\u304c\u5d29\u308c\u306a\u3044\u3053\u3068\u3092\u78ba\u8a8d\u3057\u305f<\/li><\/ul><\/section>\n","protected":false},"excerpt":{"rendered":"<p>WP_Query\u3067\u30ab\u30c6\u30b4\u30ea\u30fc\u7d5e\u308a\u8fbc\u307f\u304c\u52b9\u304b\u306a\u3044\u6642\u306b\u3001category_name\u3078\u6e21\u3059slug\u3001cat\u3084category__in\u3078\u6e21\u3059ID\u3001\u5b50\u30ab\u30c6\u30b4\u30ea\u30fc\u3001tax_query\u3001post_type\u3092\u78ba\u8a8d\u3059\u308b\u9806\u756a\u3092\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"template":"","meta":{"wpq_kicker":"WP_Query\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c8","wpq_lead":"\u30ab\u30c6\u30b4\u30ea\u30fc\u3092\u6307\u5b9a\u3057\u30660\u4ef6\u306b\u306a\u308b\u3001\u5225\u30ab\u30c6\u30b4\u30ea\u30fc\u3082\u6df7\u3056\u308b\u6642\u306f\u3001\u307e\u305a\u5f15\u6570\u3068\u6307\u5b9a\u5024\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002category_name\u306b\u306fslug\u3001cat\u3068category__in\u306b\u306fID\u3092\u6307\u5b9a\u3057\u3001\u305d\u306e\u5f8c\u3067\u5b50\u30ab\u30c6\u30b4\u30ea\u30fc\u3001tax_query\u3001post_type\u3092\u9806\u306b\u8abf\u3079\u307e\u3059\u3002","wpq_hero_title_line1":"","wpq_hero_title_line2":"","wpq_hero_title_accent":"","wpq_hero_thumbnail_alt":"WP_Query\u3067\u30ab\u30c6\u30b4\u30ea\u30fc\u7d5e\u308a\u8fbc\u307f\u304c\u52b9\u304b\u306a\u3044\u539f\u56e0\uff5c\u6307\u5b9a\u65b9\u6cd5\u3068tax_query\u3092\u78ba\u8a8d \u306e\u30d2\u30fc\u30ed\u30fc\u30b5\u30e0\u30cd\u30a4\u30eb","wpq_hero_summary_mode":"","wpq_hero_summary_label":"\u6307\u5b9a\u5024\u3092\u5148\u306b\u78ba\u8a8d","wpq_hero_summary_items":"`category_name`::\u30b9\u30e9\u30c3\u30b0\n`cat`::\u30ab\u30c6\u30b4\u30ea\u30fcID","wpq_reading_time":"","wpq_difficulty_label":"","wpq_difficulty_stars":"2","wpq_target_audience":"WP_Query\u3067\u30ab\u30c6\u30b4\u30ea\u3092\u6307\u5b9a\u3057\u305f\u306e\u306b\u3001\u6295\u7a3f\u304c\u51fa\u306a\u3044\u3001\u5225\u30ab\u30c6\u30b4\u30ea\u306e\u6295\u7a3f\u307e\u3067\u51fa\u308b\u3001\u5b50\u30ab\u30c6\u30b4\u30ea\u306e\u6271\u3044\u304c\u60f3\u5b9a\u3068\u9055\u3046\u3068\u56f0\u3063\u3066\u3044\u308b\u521d\u5fc3\u8005\u301c\u4e2d\u7d1a\u8005","wpq_updated_label":"","wpq_summary_items":"","wpq_scope_include":"","wpq_scope_exclude":"","wpq_quick_checks":"","wpq_sidebar_notes":"","wpq_sidebar_promo_text":"","wpq_sidebar_promo_label":"","wpq_sidebar_promo_url":"","wpq_builder_fields":"","wpq_official_links":"WP_Query|https:\/\/developer.wordpress.org\/reference\/classes\/wp_query\/\nWP_Tax_Query|https:\/\/developer.wordpress.org\/reference\/classes\/wp_tax_query\/\nget_category_by_slug()|https:\/\/developer.wordpress.org\/reference\/functions\/get_category_by_slug\/\nget_term_by()|https:\/\/developer.wordpress.org\/reference\/functions\/get_term_by\/","wpq_pr_notice":"","wpq_affiliate_placement":"","wpq_affiliate_program":"","wpq_affiliate_context":"","wpq_support_mode":"","wpq_popularity_score":"","wpq_author_box_name":"","wpq_author_box_role":"","wpq_author_box_body":"","wpq_author_box_avatar":"","wpq_author_box_avatar_url":"","wpq_author_avatar_url":"","wpq_reader_avatar_url":"","wpq_editor_avatar_url":"","footnotes":""},"categories":[15],"tags":[101,102,22,27],"wpq_card_label":[5],"wpq_difficulty":[11],"class_list":["post-3841","wpq_article","type-wpq_article","status-publish","hentry","category-troubleshooting","tag-category_name","tag-category__in","tag-tax_query","tag-27"],"_links":{"self":[{"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_article\/3841","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_article"}],"about":[{"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/types\/wpq_article"}],"author":[{"embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/users\/2"}],"version-history":[{"count":2,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_article\/3841\/revisions"}],"predecessor-version":[{"id":3925,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_article\/3841\/revisions\/3925"}],"wp:attachment":[{"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/media?parent=3841"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/categories?post=3841"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/tags?post=3841"},{"taxonomy":"wpq_card_label","embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_card_label?post=3841"},{"taxonomy":"wpq_difficulty","embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_difficulty?post=3841"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}