{"id":3865,"date":"2026-09-11T09:00:00","date_gmt":"2026-09-11T00:00:00","guid":{"rendered":"https:\/\/wptoolslab.com\/query-lab\/?post_type=wpq_article&#038;p=3865"},"modified":"2026-09-12T19:45:30","modified_gmt":"2026-09-12T10:45:30","slug":"custom-post-not-showing","status":"publish","type":"wpq_article","link":"https:\/\/wptoolslab.com\/query-lab\/articles\/custom-post-not-showing\/","title":{"rendered":"WP_Query\u3067\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u304c\u51fa\u306a\u3044\u539f\u56e0\uff5cpost_type\u30fb\u516c\u958b\u72b6\u614b\u3092\u78ba\u8a8d"},"content":{"rendered":"<section class=\"conclusion wpq-conclusion\"><h2 class=\"wpq-conclusion__title\">\u6700\u521d\u306bpost_type\u306e\u30b9\u30e9\u30c3\u30b0\u3068\u516c\u958b\u6e08\u307f\u4ef6\u6570\u3092\u898b\u308b<\/h2><p>\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u304c\u51fa\u306a\u3044\u3068\u304d\u306f\u3001`register_post_type()`\u306e\u7b2c1\u5f15\u6570\u3068`$args`\u306e`post_type`\u304c\u540c\u3058\u304b\u78ba\u8a8d\u3057\u307e\u3059\u3002`event`\u306a\u3069\u306e\u7b2c1\u5f15\u6570\u304c\u6295\u7a3f\u30bf\u30a4\u30d7\u306e\u30b9\u30e9\u30c3\u30b0\u3067\u3059\u3002\u7ba1\u7406\u753b\u9762\u306e\u8868\u793a\u540d\u3067\u306f\u306a\u304f\u3001\u767b\u9332\u30b9\u30e9\u30c3\u30b0\u3068\u516c\u958b\u6e08\u307f\u6295\u7a3f\u6570\u3092\u898b\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306b`post_type`\u3001`post_status => \u2018publish\u2019`\u3001\u8868\u793a\u4ef6\u6570\u3060\u3051\u3067\u8a66\u3057\u307e\u3059\u3002\u53d6\u5f97\u3067\u304d\u305f\u3089`tax_query`\u3084`meta_query`\u30921\u3064\u305a\u3064\u623b\u3057\u30010\u4ef6\u306e\u307e\u307e\u306a\u3089`get_post_type_object()`\u3067\u767b\u9332\u72b6\u614b\u3092\u78ba\u8a8d\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\u30fb404\u30fb\u8868\u793a\u305a\u308c\u3092\u5206\u3051\u308b<\/span><\/h2>\n<p><span class=\"wpq-marker wpq-marker--yellow\">\u72ec\u81ea\u306eWP_Query\u304c0\u4ef6\u306a\u306e\u304b\u3001\u30a2\u30fc\u30ab\u30a4\u30d6URL\u304c404\u306a\u306e\u304b\u3001\u30eb\u30fc\u30d7\u5f8c\u306e\u8868\u793a\u3060\u3051\u304c\u304a\u304b\u3057\u3044\u306e\u304b\u3092\u5206\u3051\u307e\u3059\u3002<\/span> \u75c7\u72b6\u3054\u3068\u306b\u78ba\u8a8d\u3059\u308b\u5834\u6240\u304c\u9055\u3046\u305f\u3081\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: \u75c7\u72b6 \/ \u6700\u521d\u306b\u7591\u3046\u539f\u56e0 \/ \u6700\u521d\u306b\u898b\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>\u6700\u521d\u306b\u898b\u308b\u5834\u6240<\/th><\/tr><\/thead><tbody><tr><td>\u72ec\u81ea\u306eWP_Query\u3060\u30510\u4ef6\u306b\u306a\u308b<\/td><td>post_type\u306e\u6307\u5b9a\u6f0f\u308c\u30fb\u30b9\u30e9\u30c3\u30b0\u9055\u3044<\/td><td>WP_Query\u306e$args<\/td><\/tr><tr><td>\u7ba1\u7406\u753b\u9762\u306b\u306f\u3042\u308b\u304c\u516c\u958b\u4e00\u89a7\u306b\u51fa\u306a\u3044<\/td><td>post_status\u304cpublish\u3067\u306f\u306a\u3044<\/td><td>\u6295\u7a3f\u306e\u516c\u958b\u72b6\u614b<\/td><\/tr><tr><td>\u6761\u4ef6\u3092\u8db3\u3057\u305f\u3089\u51fa\u306a\u304f\u306a\u3063\u305f<\/td><td>tax_query\u3084meta_query\u304c\u53b3\u3057\u3059\u304e\u308b<\/td><td>\u7d5e\u308a\u8fbc\u307f\u6761\u4ef6\u3092\u4e00\u5ea6\u5916\u3059<\/td><\/tr><tr><td>\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30a2\u30fc\u30ab\u30a4\u30d6URL\u304c404\u306b\u306a\u308b<\/td><td>has_archive\u3084rewrite\u3001publicly_queryable\u306e\u8a2d\u5b9a<\/td><td>register_post_type\u306e\u767b\u9332\u8a2d\u5b9a<\/td><\/tr><tr><td>\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u306e\u500b\u5225URL\u304c404\u306b\u306a\u308b<\/td><td>publicly_queryable\u3084rewrite\u3001\u30ea\u30e9\u30a4\u30c8\u30eb\u30fc\u30eb<\/td><td>\u767b\u9332\u8a2d\u5b9a\u3068\u30d1\u30fc\u30de\u30ea\u30f3\u30af\u8a2d\u5b9a<\/td><\/tr><tr><td>\u30eb\u30fc\u30d7\u5f8c\u306e\u30bf\u30a4\u30c8\u30eb\u3060\u3051\u5225\u6295\u7a3f\u306b\u306a\u308b<\/td><td>\u6295\u7a3f\u30c7\u30fc\u30bf\u3092\u623b\u3057\u3066\u3044\u306a\u3044<\/td><td>wp_reset_postdata()<\/td><\/tr><\/tbody><\/table><\/div><\/div>\n<p>`post_type`\u3092\u66f8\u3044\u3066\u3044\u3066\u3082\u3001\u8868\u793a\u540d\u3092\u6307\u5b9a\u3057\u3066\u3044\u305f\u308a\u3001\u30b9\u30e9\u30c3\u30b0\u306e\u30cf\u30a4\u30d5\u30f3\u3068\u30a2\u30f3\u30c0\u30fc\u30b9\u30b3\u30a2\u3092\u53d6\u308a\u9055\u3048\u305f\u308a\u3059\u308b\u3068\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<span class=\"wpq-marker wpq-marker--yellow\">`event-item`\u3068`event_item`\u306f\u5225\u306e\u6295\u7a3f\u30bf\u30a4\u30d7\u540d\u3067\u3059\u3002\u7ba1\u7406\u753b\u9762\u306e\u8868\u793a\u540d\u3067\u306f\u306a\u304f\u3001`register_post_type()`\u306e\u7b2c1\u5f15\u6570\u3068\u4e00\u5b57\u305a\u3064\u4e00\u81f4\u3057\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/span>\n<h2 id=\"common-causes\" 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\">\u3088\u304f\u3042\u308b\u539f\u56e0\u4e00\u89a7<\/span><\/h2>\n<p>\u53d6\u5f97\u5bfe\u8c61\u306e\u6307\u5b9a\u306b\u8ff7\u3046\u5834\u5408\u306f\u3001\u5148\u306b[post_type\u306e\u6307\u5b9a\u65b9\u6cd5](..\/post-type-parameter\/)\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u306b\u9650\u3089\u305a\u7d50\u679c\u304c0\u4ef6\u306b\u306a\u308b\u5834\u5408\u306f\u3001\u6761\u4ef6\u3092\u5916\u3059\u9806\u756a\u3092\u307e\u3068\u3081\u305f[\u6295\u7a3f\u304c\u8868\u793a\u3055\u308c\u306a\u3044\u6642\u306e\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8](..\/wp-query-no-posts-checklist\/)\u304b\u3089\u5207\u308a\u5206\u3051\u308b\u65b9\u304c\u65e9\u3044\u3067\u3059\u3002<\/p>\n<div class=\"wpq-related-links\"><a class=\"deep-link-card wpq-related-link wpq-related-link--internal\" href=\"https:\/\/wptoolslab.com\/query-lab\/articles\/wp-query-basics\/\"><span class=\"article-thumb wpq-related-link__thumb\"><img decoding=\"async\" alt=\"WP_Query\u306e\u57fa\u672c\u304b\u3089\u78ba\u8a8d\u3059\u308b\" src=\"https:\/\/wptoolslab.com\/query-lab\/wp-content\/uploads\/2026\/08\/wp-query-basics-card.png\" loading=\"lazy\" \/><\/span><div class=\"deep-link-copy wpq-related-link__copy\"><small>\u3042\u308f\u305b\u3066\u8aad\u307f\u305f\u3044<\/small><b>WP_Query\u306e\u57fa\u672c\u304b\u3089\u78ba\u8a8d\u3059\u308b<\/b><span class=\"jump\"><span>\u8a18\u4e8b\u3092\u8aad\u3080<\/span><\/span><\/div><\/a><a class=\"deep-link-card wpq-related-link wpq-related-link--internal\" href=\"https:\/\/wptoolslab.com\/query-lab\/?post_type=wpq_article&#038;p=4077\"><span class=\"article-thumb wpq-related-link__thumb\"><img decoding=\"async\" alt=\"\u30b3\u30fc\u30c9\u3092\u3069\u3053\u3078\u7f6e\u304f\u304b\u78ba\u8a8d\u3059\u308b\" src=\"https:\/\/wptoolslab.com\/query-lab\/wp-content\/uploads\/2026\/09\/wp-query-code-placement-card.png\" loading=\"lazy\" \/><\/span><div class=\"deep-link-copy wpq-related-link__copy\"><small>\u3042\u308f\u305b\u3066\u8aad\u307f\u305f\u3044<\/small><b>\u30b3\u30fc\u30c9\u3092\u3069\u3053\u3078\u7f6e\u304f\u304b\u78ba\u8a8d\u3059\u308b<\/b><span class=\"jump\"><span>\u8a18\u4e8b\u3092\u8aad\u3080<\/span><\/span><\/div><\/a><\/div>\n<p>\u8907\u96d1\u306a\u6761\u4ef6\u3092\u8aad\u3080\u524d\u306b\u3001\u6295\u7a3f\u30bf\u30a4\u30d7\u3001\u516c\u958b\u72b6\u614b\u3001\u7d5e\u308a\u8fbc\u307f\u6761\u4ef6\u3001\u767b\u9332\u8a2d\u5b9a\u306e\u9806\u306b\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<section class=\"debug-steps wpq-steps-card\"><h2>\u78ba\u8a8d\u3059\u308b\u9806\u756a<\/h2><ol class=\"step-list wpq-steps\"><li><span class=\"step-number wpq-step-no\">1<\/span><div class=\"step-body wpq-step-body\">post_type\u306b\u6b63\u3057\u3044\u6295\u7a3f\u30bf\u30a4\u30d7\u30b9\u30e9\u30c3\u30b0\u3092\u66f8\u3044\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3059\u308b<\/div><\/li><li><span class=\"step-number wpq-step-no\">2<\/span><div class=\"step-body wpq-step-body\">post_status\u3092publish\u306b\u3057\u3066\u6700\u5c0f\u69cb\u6210\u3067\u8a66\u3059<\/div><\/li><li><span class=\"step-number wpq-step-no\">3<\/span><div class=\"step-body wpq-step-body\">tax_query\u3001meta_query\u3001date_query\u3092\u4e00\u5ea6\u5916\u3059<\/div><\/li><li><span class=\"step-number wpq-step-no\">4<\/span><div class=\"step-body wpq-step-body\">\u6295\u7a3f\u304c\u672c\u5f53\u306b\u516c\u958b\u6e08\u307f\u304b\u78ba\u8a8d\u3059\u308b<\/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\u30bf\u30a4\u30d7\u306e\u767b\u9332\u8a2d\u5b9a\u3092\u78ba\u8a8d\u3059\u308b<\/div><\/li><li><span class=\"step-number wpq-step-no\">6<\/span><div class=\"step-body wpq-step-body\">pre_get_posts\u306a\u3069\u3067\u30af\u30a8\u30ea\u3092\u66f8\u304d\u63db\u3048\u3066\u3044\u306a\u3044\u304b\u78ba\u8a8d\u3059\u308b<\/div><\/li><\/ol><\/section>\n<h2 id=\"minimum-query\" 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\">\u6700\u5c0f\u69cb\u6210\u3067\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u304c\u53d6\u308c\u308b\u304b\u78ba\u8a8d\u3059\u308b<\/span><\/h2>\n<p>`post_type`\u3001`post_status`\u3001`posts_per_page` \u3060\u3051\u306b\u3057\u3066\u78ba\u8a8d\u3057\u307e\u3059\u3002\u3053\u306e\u4f8b\u306f `works` \u3068\u3044\u3046\u767b\u9332\u30ad\u30fc\u3092\u4f7f\u3044\u3001\u305d\u3053\u306b\u5165\u3063\u3066\u3044\u308b\u516c\u958b\u6e08\u307f\u306e\u958b\u50ac\u60c5\u5831\u3092\u6700\u59273\u4ef6\u8868\u793a\u3057\u307e\u3059\u3002\u81ea\u5206\u306e\u30b5\u30a4\u30c8\u3067\u306f\u5b9f\u969b\u306e\u767b\u9332\u30ad\u30fc\u3078\u7f6e\u304d\u63db\u3048\u3001\u30ab\u30c6\u30b4\u30ea\u30fc\u3001\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u3001\u65e5\u4ed8\u306a\u3069\u306e\u8ffd\u52a0\u6761\u4ef6\u3092\u3044\u3063\u305f\u3093\u5916\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u73fe\u5728\u306eWP Query Builder\u3067\u3001\u6295\u7a3f\u30bf\u30a4\u30d7\u3092\u300ccustom\u300d\u3001\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3092\u300cworks\u300d\u3001\u516c\u958b\u72b6\u614b\u3092\u300cpublish\u300d\u3001\u4ef6\u6570\u3092\u300c3\u300d\u306b\u3057\u3001\u81ea\u52d5\u9ad8\u901f\u5316\u3092\u30aa\u30d5\u306b\u3057\u3066\u751f\u6210\u3057\u305f\u672a\u7de8\u96c6\u306e`$args`\u3092\u4f7f\u3044\u307e\u3059\u3002Builder\u304c\u4f5c\u308b\u306e\u306f\u53d6\u5f97\u6761\u4ef6\u307e\u3067\u3067\u3001\u8868\u793a\u30eb\u30fc\u30d7\u30010\u4ef6\u6642\u306e\u6587\u8a00\u3001\u6295\u7a3fID\u306e\u8868\u793a\u3001`wp_reset_postdata()`\u306f\u624b\u52d5\u3067\u8ffd\u52a0\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>PHP\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u4f7f\u3046\u5b50\u30c6\u30fc\u30de\u306e `template-parts\/works-check.php` \u306b\u4fdd\u5b58\u3057\u3001\u8868\u793a\u3057\u305f\u3044\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u30e1\u30a4\u30f3\u30eb\u30fc\u30d7\u3067 `the_post()` \u306e\u5f8c\u306b `get_template_part( &#8216;template-parts\/works-check&#8217; );` \u3068\u547c\u3073\u307e\u3059\u3002\u6295\u7a3f\u672c\u6587\u3084\u8ffd\u52a0CSS\u306b\u306f\u8cbc\u308a\u307e\u305b\u3093\u3002\u78ba\u8a8d\u304c\u7d42\u308f\u3063\u305f\u3089\u3001\u4e0d\u8981\u306b\u306a\u3063\u305f\u547c\u3073\u51fa\u3057\u3068\u30d5\u30a1\u30a4\u30eb\u3092\u5916\u3057\u3066\u304f\u3060\u3055\u3044\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\">template-parts\/works-check.php<\/span><span class=\"code-purpose wpq-code-pill\">\u767b\u9332\u30ad\u30fcworks\u306e\u516c\u958b\u6e08\u307f\u6295\u7a3f\u3092\u6700\u59273\u4ef6\u8868\u793a\u3059\u308b\u78ba\u8a8d\u7528\u30d1\u30fc\u30c4<\/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: \u767b\u9332\u30ad\u30fcworks\u306e\u516c\u958b\u6e08\u307f\u6295\u7a3f\u3092\u6700\u59273\u4ef6\u8868\u793a\u3059\u308b\u78ba\u8a8d\u7528\u30d1\u30fc\u30c4 \/ template-parts\/works-check.php \/ PHP\"><code><span class=\"wpq-code-line\">&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">&lt;?php&lt;br \/&gt;<\/span><span class=\"wpq-code-line\"><span class=\"c-var\">$args<\/span> = <span class=\"c-keyword\">array<\/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;post_status&#039;<\/span> =&gt; <span class=\"c-str\">&#039;publish&#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\">3<\/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;\/p&gt;<\/span><span class=\"wpq-code-line\">&lt;p&gt;<span class=\"c-keyword\">if<\/span> ( <span class=\"c-var\">$works_query<\/span>-&gt;have_posts() ) {&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">   <span class=\"c-keyword\">echo<\/span> <span class=\"c-str\">&#039;&lt;ul&gt;&#039;<\/span>;&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">   <span class=\"c-keyword\">while<\/span> ( <span class=\"c-var\">$works_query<\/span>-&gt;have_posts() ) {&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">      <span class=\"c-var\">$works_query<\/span>-&gt;the_post();&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">      <span class=\"c-keyword\">echo<\/span> <span class=\"c-str\">&#039;&lt;li&gt;&lt;a href=&quot;&#039;<\/span> . esc_url( get_permalink() ) . <span class=\"c-str\">&#039;&quot;&gt;&#039;<\/span> . esc_html( get_the_title() ) . <span class=\"c-str\">&#039;&lt;\/a&gt;&#039;<\/span>;&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">      <span class=\"c-keyword\">echo<\/span> <span class=\"c-str\">&#039;&lt;br&gt;\u6295\u7a3fID\uff1a&#039;<\/span> . esc_html( (string) get_the_ID() ) . <span class=\"c-str\">&#039;&lt;\/li&gt;&#039;<\/span>;&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">   }&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">   <span class=\"c-keyword\">echo<\/span> <span class=\"c-str\">&#039;&lt;\/ul&gt;&#039;<\/span>;&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;&lt;p&gt;\u6761\u4ef6\u306b\u5408\u3046\u516c\u958b\u6e08\u307f\u306e\u60c5\u5831\u306f\u3042\u308a\u307e\u305b\u3093\u3002&lt;\/p&gt;&#039;<\/span>;&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">}&lt;\/p&gt;<\/span><span class=\"wpq-code-line\">&lt;p&gt;wp_reset_postdata();&lt;br \/&gt;<\/span><\/code><\/pre><textarea class=\"wpq-code-raw\" hidden aria-hidden=\"true\" tabindex=\"-1\">&lt;br \/&gt;\n&lt;?php&lt;br \/&gt;\n$args = array(&lt;br \/&gt;\n    &#039;post_type&#039; =&gt; &#039;works&#039;,&lt;br \/&gt;\n    &#039;post_status&#039; =&gt; &#039;publish&#039;,&lt;br \/&gt;\n    &#039;posts_per_page&#039; =&gt; 3&lt;br \/&gt;\n);&lt;\/p&gt;\n&lt;p&gt;$works_query = new WP_Query( $args );&lt;\/p&gt;\n&lt;p&gt;if ( $works_query-&gt;have_posts() ) {&lt;br \/&gt;\n   echo &#039;&lt;ul&gt;&#039;;&lt;br \/&gt;\n   while ( $works_query-&gt;have_posts() ) {&lt;br \/&gt;\n      $works_query-&gt;the_post();&lt;br \/&gt;\n      echo &#039;&lt;li&gt;&lt;a href=&quot;&#039; . esc_url( get_permalink() ) . &#039;&quot;&gt;&#039; . esc_html( get_the_title() ) . &#039;&lt;\/a&gt;&#039;;&lt;br \/&gt;\n      echo &#039;&lt;br&gt;\u6295\u7a3fID\uff1a&#039; . esc_html( (string) get_the_ID() ) . &#039;&lt;\/li&gt;&#039;;&lt;br \/&gt;\n   }&lt;br \/&gt;\n   echo &#039;&lt;\/ul&gt;&#039;;&lt;br \/&gt;\n} else {&lt;br \/&gt;\n   echo &#039;&lt;p&gt;\u6761\u4ef6\u306b\u5408\u3046\u516c\u958b\u6e08\u307f\u306e\u60c5\u5831\u306f\u3042\u308a\u307e\u305b\u3093\u3002&lt;\/p&gt;&#039;;&lt;br \/&gt;\n}&lt;\/p&gt;\n&lt;p&gt;wp_reset_postdata();&lt;br \/&gt;<\/textarea><\/div>\n<p><span class=\"wpq-marker wpq-marker--yellow\">\u6700\u5c0f\u69cb\u6210\u3067\u8868\u793a\u3055\u308c\u308b\u306a\u3089\u3001\u539f\u56e0\u306f\u5916\u3057\u305f\u6761\u4ef6\u306e\u3069\u308c\u304b\u3067\u3059\u3002<\/span> `tax_query`\u3001`meta_query`\u3001`orderby`\u3001`paged`\u30921\u3064\u305a\u3064\u623b\u3057\u307e\u3059\u30020\u4ef6\u306e\u307e\u307e\u306a\u3089\u3001\u30b9\u30e9\u30c3\u30b0\u3001\u516c\u958b\u72b6\u614b\u3001\u6295\u7a3f\u30bf\u30a4\u30d7\u306e\u767b\u9332\u72b6\u614b\u3092\u8abf\u3079\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3 id=\"post-type-results\" class=\"wpq-subheading\">work\u3068works\u306e1\u6587\u5b57\u306e\u9055\u3044\u3067\u7d50\u679c\u3092\u6bd4\u3079\u308b<\/h3>\n<p>\u540c\u30583\u4ef6\u306e\u6295\u7a3f\u306b\u5bfe\u3057\u3001\u4e0a\u306e `post_type` \u3060\u3051\u3092\u5909\u3048\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u306f `works` \u306b\u516c\u958b\u6e08\u307f3\u4ef6\u304c\u3042\u308a\u3001`work` \u306e\u6295\u7a3f\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u30eb\u30fc\u30d7\u30fb\u4ef6\u6570\u30fb\u516c\u958b\u72b6\u614b\u306f\u540c\u3058\u3067\u3059\u3002<\/p>\n<figure class=\"wpq-screenshot-frame wpq-screenshot-frame--fit-contain\"><span class=\"wpq-screenshot-frame__media\" style=\"--wpq-screenshot-ratio:140 \/ 57;\"><img decoding=\"async\" src=\"https:\/\/wptoolslab.com\/query-lab\/wp-content\/uploads\/2026\/09\/custom-post-not-showing-SC-01-scaled.png\" alt=\"post_type\u3092work\u3068\u3057\u305f\u5834\u5408\u306e0\u4ef6\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8868\u793a\u3059\u308b\u30b5\u30a4\u30c8\" loading=\"lazy\" \/><\/span><figcaption class=\"wpq-screenshot-frame__caption\"><span class=\"wpq-screenshot-frame__eyebrow\">\u6307\u5b9a\u3092\u9593\u9055\u3048\u305f\u4f8b<\/span><strong class=\"wpq-screenshot-frame__title\">work\u3067\u306f\u5bfe\u8c61\u306e\u6295\u7a3f\u304c\u306a\u3044<\/strong><p class=\"wpq-screenshot-frame__caption-text\">post_type\u3060\u3051\u3092work\u306b\u5909\u66f4\u3057\u305f\u7d50\u679c\u306f0\u4ef6\u3002\u3053\u306e\u8868\u793a\u3060\u3051\u3067\u306f\u3001\u767b\u9332\u30ad\u30fc\u306e\u9593\u9055\u3044\u304b\u3001\u516c\u958b\u6e08\u307f\u6295\u7a3f\u304c\u306a\u3044\u306e\u304b\u307e\u3067\u306f\u5206\u304b\u308a\u307e\u305b\u3093\u3002<\/p><\/figcaption><\/figure>\n<figure class=\"wpq-screenshot-frame wpq-screenshot-frame--fit-contain\"><span class=\"wpq-screenshot-frame__media\" style=\"--wpq-screenshot-ratio:245 \/ 164;\"><img decoding=\"async\" src=\"https:\/\/wptoolslab.com\/query-lab\/wp-content\/uploads\/2026\/09\/custom-post-not-showing-SC-02-scaled.png\" alt=\"post_type\u3092works\u306b\u76f4\u3059\u3068\u6295\u7a3fID18\u300117\u300116\u306e3\u4ef6\u304c\u8868\u793a\u3055\u308c\u308b\u30b5\u30a4\u30c8\" loading=\"lazy\" \/><\/span><figcaption class=\"wpq-screenshot-frame__caption\"><span class=\"wpq-screenshot-frame__eyebrow\">\u767b\u9332\u30ad\u30fc\u3092\u5408\u308f\u305b\u305f\u4f8b<\/span><strong class=\"wpq-screenshot-frame__title\">works\u3067\u306f\u516c\u958b\u6e08\u307f3\u4ef6\u304c\u51fa\u308b<\/strong><p class=\"wpq-screenshot-frame__caption-text\">\u672c\u6587\u306e\u30b3\u30fc\u30c9\u3069\u304a\u308aworks\u3092\u6307\u5b9a\u3059\u308b\u3068\u3001ID18\u30fb17\u30fb16\u306e3\u4ef6\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002\u5148\u306b\u53d6\u5f97\u6761\u4ef6\u3092\u5408\u308f\u305b\u3001\u8ffd\u52a0\u306e\u5206\u985e\u3084\u30e1\u30bf\u6761\u4ef6\u306f\u305d\u306e\u5f8c\u3067\u623b\u3057\u307e\u3059\u3002<\/p><\/figcaption><\/figure>\n\n<p>\u6295\u7a3f\u30bf\u30a4\u30d7\u306e\u8a2d\u5b9a\u3084\u8868\u793a\u30b3\u30fc\u30c9\u3092\u8abf\u3079\u308b\u4f5c\u696d\u306f\u3001\u672c\u756a\u3068\u5206\u3051\u305f\u74b0\u5883\u3067\u884c\u3044\u307e\u3059\u3002\u30b5\u30fc\u30d0\u30fc\u4e0a\u3078\u8a66\u3059\u5834\u6240\u3092\u7528\u610f\u3059\u308b\u5834\u5408\u306f\u3001Xserver\u306ePHP\u5bfe\u5fdc\u3084\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u6761\u4ef6\u3082\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n<h2 id=\"cause-details\" class=\"h-underline section-heading\"><span class=\"section-heading-icon\" aria-hidden=\"true\"><svg data-wpq-icon=\"search\" 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 21-4.34-4.34\" \/>\n  <circle cx=\"11\" cy=\"11\" r=\"8\" \/>\n<\/svg><\/span><span class=\"section-heading-text\">\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u304c\u51fa\u306a\u3044\u539f\u56e0\u3092\u9806\u306b\u78ba\u8a8d\u3059\u308b<\/span><\/h2>\n<p>\u6700\u5c0f\u69cb\u6210\u3067\u7d50\u679c\u3092\u78ba\u8a8d\u3057\u305f\u3089\u3001\u6295\u7a3f\u30bf\u30a4\u30d7\u540d\u3001\u516c\u958b\u72b6\u614b\u3001\u767b\u9332\u8a2d\u5b9a\u3001\u5916\u90e8\u51e6\u7406\u306e\u9806\u306b\u5b9f\u969b\u306e\u6761\u4ef6\u3078\u623b\u3057\u307e\u3059\u3002<\/p>\n<h3 id=\"post-type-slug\" class=\"wpq-subheading\">post_type\u306e\u30b9\u30e9\u30c3\u30b0\u9055\u3044\u3092\u78ba\u8a8d\u3059\u308b<\/h3>\n<p>\u7ba1\u7406\u753b\u9762\u306e\u300c\u30a4\u30d9\u30f3\u30c8\u300d\u306e\u3088\u3046\u306a\u8868\u793a\u540d\u3001\u6295\u7a3f\u30bf\u30a4\u30d7\u306e\u767b\u9332\u30ad\u30fc\u3001\u516c\u958bURL\u306e `rewrite[&#8216;slug&#8217;]` \u306f\u5225\u3005\u306b\u8a2d\u5b9a\u3067\u304d\u307e\u3059\u3002WP_Query\u3078\u6e21\u3059\u306e\u306f\u767b\u9332\u30ad\u30fc\u3067\u3059\u3002<\/p>\n<p>WordPress\u516c\u5f0f\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u3067\u306f\u3001WP_Query\u306e`post_type`\u306f\u6295\u7a3f\u30bf\u30a4\u30d7\u3092\u6307\u5b9a\u3059\u308b\u5f15\u6570\u3067\u3001\u901a\u5e38\u306e\u65e2\u5b9a\u5024\u306f`post`\u3067\u3059\u3002\u305f\u3060\u3057\u3001`tax_query`\u3092\u6307\u5b9a\u3057\u305f\u30af\u30a8\u30ea\u306e\u65e2\u5b9a\u5024\u306f`any`\u306b\u306a\u308a\u307e\u3059\u3002`any`\u3067\u3082\u3001`exclude_from_search`\u304c`true`\u306e\u6295\u7a3f\u30bf\u30a4\u30d7\u306a\u3069\u306f\u5bfe\u8c61\u5916\u3067\u3059\u3002\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u3092\u78ba\u5b9f\u306b\u5bfe\u8c61\u306b\u3057\u305f\u3044\u6642\u306f\u3001`post_type`\u3092\u7701\u7565\u305b\u305a\u306b\u6307\u5b9a\u3057\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: \u66f8\u304d\u65b9 \/ \u610f\u5473 \/ \u6ce8\u610f\u70b9\"><table class=\"article-table table-priority wpq-article-table\"><thead><tr><th>\u66f8\u304d\u65b9<\/th><th>\u610f\u5473<\/th><th>\u6ce8\u610f\u70b9<\/th><\/tr><\/thead><tbody><tr><td>&#039;post_type&#039; =&gt; &#039;post&#039;<\/td><td>\u901a\u5e38\u306e\u6295\u7a3f\u3092\u53d6\u5f97\u3059\u308b<\/td><td>\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u306f\u5bfe\u8c61\u5916<\/td><\/tr><tr><td>&#039;post_type&#039; =&gt; &#039;page&#039;<\/td><td>\u56fa\u5b9a\u30da\u30fc\u30b8\u3092\u53d6\u5f97\u3059\u308b<\/td><td>\u6295\u7a3f\u3068\u306f\u5225\u6271\u3044<\/td><\/tr><tr><td>&#039;post_type&#039; =&gt; &#039;event&#039;<\/td><td>event\u3068\u3044\u3046\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u3092\u53d6\u5f97\u3059\u308b<\/td><td>\u5b9f\u969b\u306e\u30b9\u30e9\u30c3\u30b0\u306b\u7f6e\u304d\u63db\u3048\u308b<\/td><\/tr><tr><td>&#039;post_type&#039; =&gt; array( &#039;post&#039;, &#039;event&#039; )<\/td><td>\u901a\u5e38\u6295\u7a3f\u3068event\u3092\u307e\u3068\u3081\u3066\u53d6\u5f97\u3059\u308b<\/td><td>\u8907\u6570\u6307\u5b9a\u306f\u914d\u5217\u3067\u66f8\u304f<\/td><\/tr><tr><td>&#039;post_type&#039; =&gt; &#039;any&#039;<\/td><td>\u8907\u6570\u306e\u6295\u7a3f\u30bf\u30a4\u30d7\u3092\u5e83\u304f\u5bfe\u8c61\u306b\u3059\u308b<\/td><td>\u3059\u3079\u3066\u306e\u6295\u7a3f\u30bf\u30a4\u30d7\u304c\u5fc5\u305a\u542b\u307e\u308c\u308b\u308f\u3051\u3067\u306f\u306a\u3044<\/td><\/tr><\/tbody><\/table><\/div><\/div>\n<p>\u30b9\u30e9\u30c3\u30b0\u304c\u5206\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u3001\u767b\u9332\u30b3\u30fc\u30c9\u3084CPT\u7cfb\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u8a2d\u5b9a\u753b\u9762\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002\u30c6\u30fc\u30de\u3084\u30d7\u30e9\u30b0\u30a4\u30f3\u5185\u3067`register_post_type( &#8216;event&#8217;, &#8230; )`\u306e\u3088\u3046\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u308b\u306a\u3089\u3001WP_Query\u306b\u6307\u5b9a\u3059\u308b\u306e\u306f`event`\u3067\u3059\u3002<\/p>\n<p>\u4e00\u6642\u7684\u306b\u30b3\u30fc\u30c9\u3067\u78ba\u8a8d\u3057\u305f\u3044\u5834\u5408\u306f\u3001`get_post_type_object()` \u3092\u4f7f\u3046\u65b9\u6cd5\u3082\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u306f\u6307\u5b9a\u3057\u305f\u6295\u7a3f\u30bf\u30a4\u30d7\u540d\u306e\u767b\u9332\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b\u95a2\u6570\u3067\u3001\u5b58\u5728\u3057\u306a\u3044\u6295\u7a3f\u30bf\u30a4\u30d7\u540d\u306a\u3089 `null` \u304c\u8fd4\u308a\u307e\u3059\u3002<\/p>\n<p>\u6b21\u3092 `template-parts\/debug-post-type.php` \u306b\u4fdd\u5b58\u3057\u3001\u5148\u307b\u3069\u3068\u540c\u3058\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u304b\u3089 `get_template_part( &#8216;template-parts\/debug-post-type&#8217; );` \u3068\u4e00\u6642\u7684\u306b\u547c\u3073\u307e\u3059\u3002\u901a\u5e38\u306f `init` \u3067\u767b\u9332\u3055\u308c\u308b\u305f\u3081\u3001\u305d\u306e\u5f8c\u306b\u5b9f\u884c\u3055\u308c\u308b\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067\u78ba\u8a8d\u3057\u307e\u3059\u3002\u8aad\u307f\u8fbc\u307f\u9014\u4e2d\u306e `functions.php` \u306e\u5148\u982d\u3067\u5224\u5b9a\u3057\u306a\u3044\u3067\u304f\u3060\u3055\u3044\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\">template-parts\/debug-post-type.php<\/span><span class=\"code-purpose wpq-code-pill\">\u6295\u7a3f\u30bf\u30a4\u30d7works\u306e\u767b\u9332\u6709\u7121\u3092\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u304b\u3089\u78ba\u8a8d\u3059\u308b\u30d1\u30fc\u30c4<\/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: \u6295\u7a3f\u30bf\u30a4\u30d7works\u306e\u767b\u9332\u6709\u7121\u3092\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u304b\u3089\u78ba\u8a8d\u3059\u308b\u30d1\u30fc\u30c4 \/ template-parts\/debug-post-type.php \/ PHP\"><code><span class=\"wpq-code-line\">&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">&lt;?php&lt;br \/&gt;<\/span><span class=\"wpq-code-line\"><span class=\"c-var\">$checked_post_type<\/span> = <span class=\"c-str\">&#039;works&#039;<\/span>;&lt;br \/&gt;<\/span><span class=\"wpq-code-line\"><span class=\"c-var\">$post_type_object<\/span> = get_post_type_object( <span class=\"c-var\">$checked_post_type<\/span> );&lt;\/p&gt;<\/span><span class=\"wpq-code-line\">&lt;p&gt;<span class=\"c-keyword\">if<\/span> ( <span class=\"c-var\">$post_type_object<\/span> ) {&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">   <span class=\"c-keyword\">echo<\/span> <span class=\"c-str\">&#039;&lt;p&gt;&#039;<\/span> . esc_html( <span class=\"c-var\">$checked_post_type<\/span> . <span class=\"c-str\">&#039; \u306f\u767b\u9332\u3055\u308c\u3066\u3044\u307e\u3059\u3002&#039;<\/span> ) . <span class=\"c-str\">&#039;&lt;\/p&gt;&#039;<\/span>;&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;&lt;p&gt;&#039;<\/span> . esc_html( <span class=\"c-var\">$checked_post_type<\/span> . <span class=\"c-str\">&#039; \u306f\u767b\u9332\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002&#039;<\/span> ) . <span class=\"c-str\">&#039;&lt;\/p&gt;&#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&lt;?php&lt;br \/&gt;\n$checked_post_type = &#039;works&#039;;&lt;br \/&gt;\n$post_type_object = get_post_type_object( $checked_post_type );&lt;\/p&gt;\n&lt;p&gt;if ( $post_type_object ) {&lt;br \/&gt;\n   echo &#039;&lt;p&gt;&#039; . esc_html( $checked_post_type . &#039; \u306f\u767b\u9332\u3055\u308c\u3066\u3044\u307e\u3059\u3002&#039; ) . &#039;&lt;\/p&gt;&#039;;&lt;br \/&gt;\n} else {&lt;br \/&gt;\n   echo &#039;&lt;p&gt;&#039; . esc_html( $checked_post_type . &#039; \u306f\u767b\u9332\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002&#039; ) . &#039;&lt;\/p&gt;&#039;;&lt;br \/&gt;\n}&lt;br \/&gt;<\/textarea><\/div>\n<p>\u300c\u767b\u9332\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u300d\u3068\u51fa\u305f\u3089\u3001\u6295\u7a3f\u30bf\u30a4\u30d7\u540d\u3001\u767b\u9332\u51e6\u7406\u306e\u8aad\u307f\u8fbc\u307f\u9806\u3001CPT\u3092\u767b\u9332\u3059\u308b\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u6709\u52b9\u5316\u72b6\u614b\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002\u78ba\u8a8d\u5f8c\u306f\u3053\u306e\u30d1\u30fc\u30c4\u306e\u547c\u3073\u51fa\u3057\u3068\u30d5\u30a1\u30a4\u30eb\u3082\u5916\u3057\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u6295\u7a3f\u304c\u6b8b\u3063\u3066\u3044\u308c\u3070\u3001\u672a\u767b\u9332\u306e\u6295\u7a3f\u30bf\u30a4\u30d7\u3067\u3082\u660e\u793a\u3057\u305f\u72ec\u81ea\u30af\u30a8\u30ea\u3067\u53d6\u5f97\u3067\u304d\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<span class=\"wpq-marker wpq-marker--yellow\">\u300c\u4e00\u89a7\u306b\u51fa\u305f\u300d\u3053\u3068\u3060\u3051\u3067\u306f\u3001\u6295\u7a3f\u30bf\u30a4\u30d7\u306e\u767b\u9332\u3084\u500b\u5225URL\u307e\u3067\u6b63\u5e38\u3068\u306f\u5224\u65ad\u3067\u304d\u307e\u305b\u3093\u3002<\/span><\/p>\n<h3 id=\"post-status-and-conditions\" class=\"wpq-subheading\">\u516c\u958b\u72b6\u614b\u3068\u7d5e\u308a\u8fbc\u307f\u6761\u4ef6\u3092\u78ba\u8a8d\u3059\u308b<\/h3>\n<p>`post_type` \u304c\u6b63\u3057\u304f\u3066\u3082\u3001\u5bfe\u8c61\u306e\u6295\u7a3f\u304c\u4e0b\u66f8\u304d\u3001\u4e88\u7d04\u6295\u7a3f\u3001\u975e\u516c\u958b\u306a\u3069\u306b\u306a\u3063\u3066\u3044\u308b\u3068\u3001\u901a\u5e38\u306e\u516c\u958b\u30da\u30fc\u30b8\u3067\u306f\u671f\u5f85\u901a\u308a\u306b\u51fa\u306a\u3044\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002WP_Query\u306e `post_status` \u306f\u3001\u7279\u306b\u6307\u5b9a\u3057\u306a\u3044\u5834\u5408\u306f\u57fa\u672c\u7684\u306b\u516c\u958b\u6e08\u307f\u6295\u7a3f\u3092\u5bfe\u8c61\u306b\u3059\u308b\u3082\u306e\u3068\u3057\u3066\u8003\u3048\u308b\u3068\u5206\u304b\u308a\u3084\u3059\u3044\u3067\u3059\u3002<\/p>\n<p>\u516c\u958b\u30da\u30fc\u30b8\u3067\u306f `post_status =&gt; &#8216;publish&#8217;` \u3092\u660e\u793a\u3057\u3066\u78ba\u8a8d\u3057\u307e\u3059\u3002\u4e0b\u66f8\u304d\u3084\u975e\u516c\u958b\u306e\u6709\u7121\u306f\u6a29\u9650\u306e\u3042\u308b\u7ba1\u7406\u753b\u9762\u3067\u8abf\u3079\u3001\u8868\u793a\u3092\u51fa\u3059\u305f\u3081\u306b `any` \u3078\u5e83\u3052\u305f\u308a\u3001\u516c\u958b\u4e88\u5b9a\u3067\u306a\u3044\u6295\u7a3f\u3092\u516c\u958b\u3057\u305f\u308a\u3057\u306a\u3044\u3067\u304f\u3060\u3055\u3044\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: \u78ba\u8a8d\u9805\u76ee \/ \u539f\u56e0\u306b\u306a\u308a\u3084\u3059\u3044\u72b6\u614b \/ \u5bfe\u51e6\"><table class=\"article-table table-priority wpq-article-table\"><thead><tr><th>\u78ba\u8a8d\u9805\u76ee<\/th><th>\u539f\u56e0\u306b\u306a\u308a\u3084\u3059\u3044\u72b6\u614b<\/th><th>\u5bfe\u51e6<\/th><\/tr><\/thead><tbody><tr><td>\u516c\u958b\u72b6\u614b<\/td><td>\u4e0b\u66f8\u304d\u3001\u4e88\u7d04\u6295\u7a3f\u3001\u975e\u516c\u958b\u306b\u306a\u3063\u3066\u3044\u308b<\/td><td>\u7ba1\u7406\u753b\u9762\u3067\u72b6\u614b\u3092\u78ba\u8a8d\u3059\u308b<\/td><\/tr><tr><td>\u6295\u7a3f\u4ef6\u6570<\/td><td>\u5bfe\u8c61\u306e\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u304c\u307e\u30600\u4ef6<\/td><td>\u672c\u756a\u3068\u5206\u3051\u305f\u74b0\u5883\u3067\u30c6\u30b9\u30c8\u6295\u7a3f\u3092\u7528\u610f\u3059\u308b<\/td><\/tr><tr><td>tax_query<\/td><td>\u30bf\u30fc\u30e0\u306e\u30b9\u30e9\u30c3\u30b0\u3084taxonomy\u540d\u304c\u9055\u3046<\/td><td>\u6761\u4ef6\u3092\u5916\u3057\u3066\u304b\u3089\u623b\u3059<\/td><\/tr><tr><td>meta_query<\/td><td>\u30e1\u30bf\u30ad\u30fc\u3084\u5024\u306e\u5f62\u5f0f\u304c\u9055\u3046<\/td><td>\u6761\u4ef6\u3092\u5916\u3057\u3066\u304b\u3089\u5024\u3092\u78ba\u8a8d\u3059\u308b<\/td><\/tr><tr><td>date_query<\/td><td>\u65e5\u4ed8\u6761\u4ef6\u306e\u7bc4\u56f2\u5916\u306b\u306a\u3063\u3066\u3044\u308b<\/td><td>\u65e5\u4ed8\u6761\u4ef6\u306a\u3057\u3067\u78ba\u8a8d\u3059\u308b<\/td><\/tr><\/tbody><\/table><\/div><\/div>\n<p>\u6761\u4ef6\u3092\u8db3\u3057\u305f\u76f4\u5f8c\u306b0\u4ef6\u306b\u306a\u3063\u305f\u306a\u3089\u3001\u305d\u306e\u6761\u4ef6\u3092\u8abf\u3079\u307e\u3059\u3002\u305f\u3068\u3048\u3070`tax_query`\u306a\u3089\u3001\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u540d\u3001\u30bf\u30fc\u30e0\u30b9\u30e9\u30c3\u30b0\u3001`relation`\u3001`operator`\u304c\u610f\u56f3\u3069\u304a\u308a\u304b\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n\n<p>\u767b\u9332\u30ad\u30fc\u3068\u516c\u958b\u72b6\u614b\u3067\u53d6\u5f97\u3067\u304d\u305f\u3089\u3001WP Query Builder\u3067\u6b21\u306e\u7d5e\u308a\u8fbc\u307f\u3092\u7d44\u307f\u7acb\u3066\u3089\u308c\u307e\u3059\u3002\u751f\u6210\u3057\u305f$args\u3092\u6700\u521d\u306e\u8868\u793a\u30eb\u30fc\u30d7\u3078\u6e21\u3057\u3001\u6761\u4ef6\u30921\u3064\u52a0\u3048\u308b\u3054\u3068\u306b\u5bfe\u8c61\u306e\u6295\u7a3fID\u3092\u898b\u6bd4\u3079\u307e\u3059\u3002<\/p>\n<section class=\"builder-cta wpq-builder-panel\"><div class=\"builder-icon\" aria-hidden=\"true\"><\/div><div class=\"wpq-builder-panel__copy\"><h3>\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u306e\u53d6\u5f97\u6761\u4ef6\u3092\u4f5c\u308b<\/h3><p>\u6295\u7a3f\u30bf\u30a4\u30d7\u30fb\u516c\u958b\u72b6\u614b\u30fb\u4ef6\u6570\u30fb\u7d5e\u308a\u8fbc\u307f\u304b\u3089$args\u3092\u4f5c\u308c\u307e\u3059\u3002\u6295\u7a3f\u30bf\u30a4\u30d7\u306e\u767b\u9332\u3068URL\u8a2d\u5b9a\u306f\u3001WordPress\u5074\u3067\u5225\u306b\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p><\/div><div class=\"builder-actions wpq-builder-panel__actions\"><a class=\"button wpq-button wpq-button--primary\" href=\"https:\/\/wptoolslab.com\/query-builder\/\">WP Query Builder\u3067\u30af\u30a8\u30ea\u3092\u4f5c\u308b<\/a><\/div><\/section>\n\n<h3 id=\"archive-and-registration\" class=\"wpq-subheading\">\u30a2\u30fc\u30ab\u30a4\u30d6URL\u304c\u51fa\u306a\u3044\u5834\u5408\u306f\u767b\u9332\u8a2d\u5b9a\u3092\u898b\u308b<\/h3>\n<p>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u5185\u306e `new WP_Query()` \u3067\u306f\u306a\u304f\u3001\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30a2\u30fc\u30ab\u30a4\u30d6\u306eURL\u304c\u8868\u793a\u3055\u308c\u306a\u3044\u3001404\u306b\u306a\u308b\u3001\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u30a2\u30fc\u30ab\u30a4\u30d6\u3067\u6295\u7a3f\u304c\u51fa\u306a\u3044\u3001\u3068\u3044\u3046\u5834\u5408\u306f\u3001WP_Query\u306e\u66f8\u304d\u65b9\u3060\u3051\u3067\u306f\u306a\u304f\u3001\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u306e\u767b\u9332\u8a2d\u5b9a\u3082\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<p>`public` \u3092 `true` \u306b\u3059\u308b\u3068\u3001\u500b\u5225\u6307\u5b9a\u304c\u306a\u3044\u5834\u5408\u306e `publicly_queryable`\u30fb`show_ui`\u30fb`show_in_nav_menus` \u306f `true`\u3001`exclude_from_search` \u306f\u9006\u306e `false` \u306b\u306a\u308a\u307e\u3059\u3002\u305f\u3060\u3057\u5404\u8a2d\u5b9a\u306f\u500b\u5225\u306b\u4e0a\u66f8\u304d\u3067\u304d\u3001`has_archive` \u304c\u81ea\u52d5\u7684\u306b `true` \u306b\u306a\u308b\u308f\u3051\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u3053\u306e\u8a18\u4e8b\u306e `works` \u306f `has_archive =&gt; false` \u3067\u3059\u304c\u3001\u6700\u521d\u306e\u72ec\u81ea\u30af\u30a8\u30ea\u3067\u306f3\u4ef6\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<span class=\"wpq-marker wpq-marker--yellow\">\u30a2\u30fc\u30ab\u30a4\u30d6\u3092\u6301\u3064\u304b\u3069\u3046\u304b\u3068\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u5185\u306e\u72ec\u81ea\u30af\u30a8\u30ea\u3067\u53d6\u5f97\u3067\u304d\u308b\u304b\u306f\u5225\u306e\u78ba\u8a8d\u3067\u3059\u3002<\/span> \u516c\u958b\u8a2d\u5b9a\u3092\u5909\u3048\u308b\u5834\u5408\u3082\u3001\u4e0b\u66f8\u304d\u3084\u5185\u90e8\u7528\u9014\u306e\u6295\u7a3f\u3092\u8aad\u8005\u3078\u898b\u305b\u306a\u3044\u8981\u4ef6\u3092\u5148\u306b\u78ba\u8a8d\u3057\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: \u898b\u3066\u3044\u308b\u753b\u9762 \/ \u95a2\u4fc2\u3057\u3084\u3059\u3044\u8a2d\u5b9a \/ \u88dc\u8db3\"><table class=\"article-table table-priority wpq-article-table\"><thead><tr><th>\u898b\u3066\u3044\u308b\u753b\u9762<\/th><th>\u95a2\u4fc2\u3057\u3084\u3059\u3044\u8a2d\u5b9a<\/th><th>\u88dc\u8db3<\/th><\/tr><\/thead><tbody><tr><td>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u5185\u306e\u72ec\u81eaWP_Query<\/td><td>post_type\u3001post_status\u3001\u7d5e\u308a\u8fbc\u307f\u6761\u4ef6<\/td><td>\u307e\u305a\u6700\u5c0f\u69cb\u6210\u3067\u78ba\u8a8d\u3059\u308b<\/td><\/tr><tr><td>\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30a2\u30fc\u30ab\u30a4\u30d6URL<\/td><td>has_archive\u3001rewrite\u3001publicly_queryable<\/td><td>URL\u5074\u306e\u8868\u793a\u8a2d\u5b9a\u3092\u78ba\u8a8d\u3059\u308b<\/td><\/tr><tr><td>\u691c\u7d22\u7d50\u679c\u306b\u51fa\u306a\u3044<\/td><td>exclude_from_search<\/td><td>\u691c\u7d22\u5bfe\u8c61\u304b\u3089\u9664\u5916\u3057\u3066\u3044\u306a\u3044\u304b\u78ba\u8a8d\u3059\u308b<\/td><\/tr><tr><td>\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u30a2\u30fc\u30ab\u30a4\u30d6\u3067\u51fa\u306a\u3044<\/td><td>exclude_from_search\u3084\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u3068\u306e\u7d10\u3065\u3051<\/td><td>\u6295\u7a3f\u30bf\u30a4\u30d7\u3068\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u306e\u767b\u9332\u3092\u78ba\u8a8d\u3059\u308b<\/td><\/tr><\/tbody><\/table><\/div><\/div>\n<p>\u305f\u3068\u3048\u3070\u300c`\/event\/` \u306e\u4e00\u89a7\u304c404\u306b\u306a\u308b\u300d\u3068\u3044\u3046\u76f8\u8ac7\u3068\u3001\u300c\u56fa\u5b9a\u30da\u30fc\u30b8\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306b\u66f8\u3044\u305fWP_Query\u3067 `event` \u304c0\u4ef6\u306b\u306a\u308b\u300d\u3068\u3044\u3046\u76f8\u8ac7\u306f\u3001\u4f3c\u3066\u3044\u3066\u3082\u5225\u306e\u554f\u984c\u3067\u3059\u3002\u524d\u8005\u306f\u30a2\u30fc\u30ab\u30a4\u30d6\u3084\u30ea\u30e9\u30a4\u30c8\u30eb\u30fc\u30eb\u306e\u8a2d\u5b9a\u3001\u5f8c\u8005\u306fWP_Query\u306e\u6761\u4ef6\u3092\u5148\u306b\u7591\u3044\u307e\u3059\u3002<\/p>\n<aside class=\"callout callout-warning wpq-callout wpq-callout--warning\"><p class=\"callout-title wpq-callout__title\"><span class=\"wpq-callout__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>\u30ea\u30e9\u30a4\u30c8\u30eb\u30fc\u30eb\u306e\u66f4\u65b0\u306f\u4e00\u5ea6\u3060\u3051<\/span><\/p><p>`rewrite`\u3084`has_archive`\u3092\u5909\u66f4\u3057\u305f\u5f8c\u306f\u3001\u7ba1\u7406\u753b\u9762\u306e\u300c\u8a2d\u5b9a \u2192 \u30d1\u30fc\u30de\u30ea\u30f3\u30af\u300d\u3092\u4e00\u5ea6\u4fdd\u5b58\u3059\u308b\u3068\u30ea\u30e9\u30a4\u30c8\u30eb\u30fc\u30eb\u3092\u66f4\u65b0\u3067\u304d\u307e\u3059\u3002`flush_rewrite_rules()`\u3092\u901a\u5e38\u30a2\u30af\u30bb\u30b9\u306e\u305f\u3073\u306b\u5b9f\u884c\u3059\u308b\u30b3\u30fc\u30c9\u306f\u8ca0\u8377\u306b\u306a\u308b\u305f\u3081\u7f6e\u304b\u305a\u3001\u30d7\u30e9\u30b0\u30a4\u30f3\u6709\u52b9\u5316\u6642\u3084\u30c6\u30fc\u30de\u5207\u308a\u66ff\u3048\u6642\u306a\u3069\u5fc5\u8981\u306a\u4e00\u5ea6\u3060\u3051\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<\/aside>\n<h3 id=\"pre-get-posts-and-loop\" class=\"wpq-subheading\">pre_get_posts\u3084\u30eb\u30fc\u30d7\u306e\u5f8c\u51e6\u7406\u3082\u78ba\u8a8d\u3059\u308b<\/h3>\n<p>\u30b5\u30a4\u30c8\u5168\u4f53\u3067 `pre_get_posts` \u3092\u4f7f\u3063\u3066\u3044\u308b\u5834\u5408\u3001\u610f\u56f3\u305b\u305a\u5225\u306e\u30af\u30a8\u30ea\u306b\u3082\u6761\u4ef6\u304c\u52b9\u3044\u3066\u3044\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u305f\u3068\u3048\u3070\u3001\u30e1\u30a4\u30f3\u30af\u30a8\u30ea\u7528\u306b\u66f8\u3044\u305f\u3064\u3082\u308a\u306e\u6761\u4ef6\u304c\u3001\u7ba1\u7406\u753b\u9762\u3084\u5225\u306e\u4e00\u89a7\u306b\u3082\u5f71\u97ff\u3057\u3066\u3057\u307e\u3046\u3068\u3001\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u304c\u51fa\u306a\u3044\u3088\u3046\u306b\u898b\u3048\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p><span class=\"wpq-marker wpq-marker--yellow\">\u30e1\u30a4\u30f3\u30af\u30a8\u30ea\u3060\u3051\u3092\u5909\u3048\u308b\u306a\u3089\u3001\u7ba1\u7406\u753b\u9762\u3092\u9664\u5916\u3057\u3001\u30d5\u30c3\u30af\u3067\u53d7\u3051\u53d6\u3063\u305f `$query-&gt;is_main_query()` \u3067\u5bfe\u8c61\u3092\u9650\u5b9a\u3057\u307e\u3059\u3002<\/span> \u307e\u305f\u3001\u72ec\u81ea\u306eWP_Query\u3067 `the_post()` \u3092\u4f7f\u3063\u305f\u5f8c\u306f `wp_reset_postdata()` \u3067\u6295\u7a3f\u30c7\u30fc\u30bf\u3092\u623b\u3057\u307e\u3059\u3002\u3053\u308c\u3092\u5fd8\u308c\u308b\u3068\u3001\u5f8c\u7d9a\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30bf\u30b0\u304c\u5225\u306e\u6295\u7a3f\u3092\u53c2\u7167\u3057\u307e\u3059\u3002<\/p>\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\">\u6295\u7a3f\u30bf\u30a4\u30d7\u306e\u767b\u9332\u3068\u53d6\u5f97\u6761\u4ef6\u306e\u516c\u5f0f\u8cc7\u6599<\/span><\/h2>\n<p>`post_type`\u3068`post_status`\u306fWP_Query\u3001\u516c\u958b\u7bc4\u56f2\u306f`register_post_type()`\u3001\u767b\u9332\u306e\u6709\u7121\u306f`get_post_type_object()`\u3001\u30e1\u30a4\u30f3\u30af\u30a8\u30ea\u306e\u5909\u66f4\u306f`pre_get_posts`\u306e\u516c\u5f0f\u8cc7\u6599\u3067\u78ba\u8a8d\u3057\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 Class<\/strong><span class=\"wpq-reference-item__description\">post_type\u3001post_status\u3001\u6a19\u6e96\u30eb\u30fc\u30d7\u3001wp_reset_postdata()\u306e\u4f7f\u3044\u65b9\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\/register_post_type\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span class=\"wpq-reference-item__copy\"><strong class=\"wpq-reference-item__title\">register_post_type()<\/strong><span class=\"wpq-reference-item__description\">\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u306epublic\u3001exclude_from_search\u3001publicly_queryable\u306a\u3069\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_post_type_object\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span class=\"wpq-reference-item__copy\"><strong class=\"wpq-reference-item__title\">get_post_type_object()<\/strong><span class=\"wpq-reference-item__description\">\u6307\u5b9a\u3057\u305f\u6295\u7a3f\u30bf\u30a4\u30d7\u540d\u304c\u767b\u9332\u3055\u308c\u3066\u3044\u308b\u304b\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\/hooks\/pre_get_posts\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span class=\"wpq-reference-item__copy\"><strong class=\"wpq-reference-item__title\">pre_get_posts<\/strong><span class=\"wpq-reference-item__description\">\u30e1\u30a4\u30f3\u30af\u30a8\u30ea\u3092\u66f8\u304d\u63db\u3048\u3066\u3044\u308b\u51e6\u7406\u304c\u5f71\u97ff\u3057\u3066\u3044\u306a\u3044\u304b\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\u306b\u78ba\u8a8d\u3057\u305f\u3044\u3053\u3068<\/span><\/h2>\n<p>\u6700\u5c0f\u69cb\u6210\u3067\u8868\u793a\u3055\u308c\u308b\u306a\u3089\u8ffd\u52a0\u6761\u4ef6\u30010\u4ef6\u306a\u3089\u30b9\u30e9\u30c3\u30b0\u3001\u516c\u958b\u72b6\u614b\u3001\u767b\u9332\u72b6\u614b\u3092\u8abf\u3079\u307e\u3059\u3002\u30a2\u30fc\u30ab\u30a4\u30d6\u3084\u500b\u5225URL\u306e404\u306f\u72ec\u81ea\u30af\u30a8\u30ea\u3068\u5206\u3051\u3066\u3001\u767b\u9332\u8a2d\u5b9a\u3068\u30ea\u30e9\u30a4\u30c8\u30eb\u30fc\u30eb\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\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\u30b9\u30bf\u30e0\u6295\u7a3f\u306e\u6700\u7d42\u5224\u65ad<\/h2><\/div><ul class=\"wpq-checklist\"><li>\u6295\u7a3f\u30bf\u30a4\u30d7\u304c\u767b\u9332\u6e08\u307f\u3067\u516c\u958b\u5bfe\u8c61\u306b\u306a\u3063\u3066\u3044\u308b<\/li><li>\u72ec\u81ea\u30af\u30a8\u30ea\u3068\u30a2\u30fc\u30ab\u30a4\u30d6URL\u306e\u554f\u984c\u3092\u5206\u3051\u305f<\/li><li>\u5206\u985e\u30fb\u30e1\u30bf\u6761\u4ef6\u3092\u623b\u3057\u305f\u5f8c\u306e\u5bfe\u8c61\u4ef6\u6570\u3092\u6bd4\u8f03\u3057\u305f<\/li><li>pre_get_posts\u306e\u5bfe\u8c61\u7bc4\u56f2\u3092\u9650\u5b9a\u3057\u305f<\/li><li>\u30b5\u30d6\u30eb\u30fc\u30d7\u5f8c\u306b\u672c\u6765\u306e\u8a18\u4e8b\u60c5\u5831\u3078\u623b\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u305f<\/li><\/ul><\/section>\n","protected":false},"excerpt":{"rendered":"<p>WP_Query\u3067\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u304c0\u4ef6\u306b\u306a\u308b\u6642\u306f\u3001post_type\u306e\u30b9\u30e9\u30c3\u30b0\u3001\u516c\u958b\u72b6\u614b\u3001\u8ffd\u52a0\u6761\u4ef6\u3001\u767b\u9332\u72b6\u614b\u3092\u9806\u306b\u78ba\u8a8d\u3057\u307e\u3059\u3002\u30a2\u30fc\u30ab\u30a4\u30d6URL\u306e404\u3084\u30eb\u30fc\u30d7\u5f8c\u306e\u8868\u793a\u305a\u308c\u3068\u306e\u9055\u3044\u3082\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"template":"","meta":{"wpq_kicker":"\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c8","wpq_lead":"\u300c\u7ba1\u7406\u753b\u9762\u306b\u306f\u30a4\u30d9\u30f3\u30c8\u304c\u3042\u308b\u306e\u306b\u3001\u4e00\u89a7\u306b\u306f1\u4ef6\u3082\u51fa\u306a\u3044\u300d\u5834\u5408\u306f\u3001\u767b\u9332\u6642\u306e\u6295\u7a3f\u30bf\u30a4\u30d7\u540d\u3068WP_Query\u306epost_type\u304c\u540c\u3058\u304b\u4e00\u5b57\u305a\u3064\u78ba\u8a8d\u3057\u307e\u3059\u3002\u6b21\u306b\u516c\u958b\u6e08\u307f\u6295\u7a3f\u304c\u3042\u308b\u304b\u3092\u78ba\u8a8d\u3057\u3001tax_query\u3084meta_query\u3092\u5916\u3057\u305f\u6700\u5c0f\u30af\u30a8\u30ea\u3067\u539f\u56e0\u3092\u5207\u308a\u5206\u3051\u307e\u3059\u3002","wpq_hero_title_line1":"","wpq_hero_title_line2":"","wpq_hero_title_accent":"","wpq_hero_thumbnail_alt":"WP_Query\u3067\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u304c\u51fa\u306a\u3044\u539f\u56e0\uff5cpost_type\u30fb\u516c\u958b\u72b6\u614b\u3092\u78ba\u8a8d \u306e\u30d2\u30fc\u30ed\u30fc\u30b5\u30e0\u30cd\u30a4\u30eb","wpq_hero_summary_mode":"","wpq_hero_summary_label":"\u6700\u521d\u306e2\u70b9","wpq_hero_summary_items":"`post_type`::\u767b\u9332\u30b9\u30e9\u30c3\u30b0\n`post_status`::\u516c\u958b\u72b6\u614b","wpq_reading_time":"","wpq_difficulty_label":"","wpq_difficulty_stars":"2","wpq_target_audience":"WP_Query\u3067\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u306e\u8a18\u4e8b\u4e00\u89a7\u3092\u8868\u793a\u3057\u305f\u3044\u304c\u3001\u6295\u7a3f\u304c0\u4ef6\u306b\u306a\u3063\u3066\u56f0\u3063\u3066\u3044\u308bWordPress\u521d\u7d1a\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 Class|https:\/\/developer.wordpress.org\/reference\/classes\/wp_query\/\nregister_post_type()|https:\/\/developer.wordpress.org\/reference\/functions\/register_post_type\/\nget_post_type_object()|https:\/\/developer.wordpress.org\/reference\/functions\/get_post_type_object\/\npre_get_posts|https:\/\/developer.wordpress.org\/reference\/hooks\/pre_get_posts\/\nwp reset postdata|https:\/\/developer.wordpress.org\/reference\/functions\/wp_reset_postdata\/","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":[113,19,21,26],"wpq_card_label":[5],"wpq_difficulty":[11],"class_list":["post-3865","wpq_article","type-wpq_article","status-publish","hentry","category-troubleshooting","tag-post_status","tag-post_type","tag-pre_get_posts","tag-26"],"_links":{"self":[{"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_article\/3865","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":3,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_article\/3865\/revisions"}],"predecessor-version":[{"id":4055,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_article\/3865\/revisions\/4055"}],"wp:attachment":[{"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/media?parent=3865"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/categories?post=3865"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/tags?post=3865"},{"taxonomy":"wpq_card_label","embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_card_label?post=3865"},{"taxonomy":"wpq_difficulty","embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_difficulty?post=3865"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}