{"id":433,"date":"2026-08-15T22:08:27","date_gmt":"2026-08-15T13:08:27","guid":{"rendered":"https:\/\/wptoolslab.com\/query-lab\/?post_type=wpq_glossary&amp;p=433"},"modified":"2026-08-29T22:52:39","modified_gmt":"2026-08-29T13:52:39","slug":"custom-query","status":"publish","type":"wpq_glossary","link":"https:\/\/wptoolslab.com\/query-lab\/glossary\/custom-query\/","title":{"rendered":"custom query"},"content":{"rendered":"<section class=\"conclusion wpq-conclusion\"><h2 class=\"wpq-conclusion__title\">\u307e\u305a\u7d50\u8ad6<\/h2><p>custom query \u306f\u3001WordPress \u304c\u73fe\u5728\u306e\u30da\u30fc\u30b8\u7528\u306b\u81ea\u52d5\u3067\u7528\u610f\u3059\u308b main query \u3068\u306f\u5225\u306b\u3001\u958b\u767a\u8005\u304c\u72ec\u81ea\u306b\u4f5c\u308b\u6295\u7a3f\u53d6\u5f97\u30af\u30a8\u30ea\u3067\u3059\u3002\u95a2\u9023\u8a18\u4e8b\u3001\u6700\u65b0\u8a18\u4e8b\u3001\u30b5\u30a4\u30c9\u30d0\u30fc\u4e00\u89a7\u306a\u3069\u3001\u30da\u30fc\u30b8\u672c\u4f53\u3068\u306f\u5225\u306e\u6295\u7a3f\u4e00\u89a7\u3092\u51fa\u3057\u305f\u3044\u6642\u306b\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<\/section>\n<p>WordPress \u306b\u306f\u3001\u73fe\u5728\u306e\u30da\u30fc\u30b8\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306e main query \u304c\u3042\u308a\u307e\u3059\u3002\u30ab\u30c6\u30b4\u30ea\u30fc\u30a2\u30fc\u30ab\u30a4\u30d6\u306a\u3089\u305d\u306e\u30ab\u30c6\u30b4\u30ea\u30fc\u306e\u8a18\u4e8b\u3001\u691c\u7d22\u7d50\u679c\u306a\u3089\u691c\u7d22\u8a9e\u306b\u4e00\u81f4\u3059\u308b\u8a18\u4e8b\u3001\u6295\u7a3f\u8a73\u7d30\u306a\u3089\u305d\u306e\u6295\u7a3f1\u4ef6\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306e\u30af\u30a8\u30ea\u3067\u3059\u3002<\/p>\n<p>custom query \u306f\u3001\u305d\u308c\u3068\u306f\u5225\u306b\u8ffd\u52a0\u3067\u4f5c\u308b\u30af\u30a8\u30ea\u3067\u3059\u3002\u305f\u3068\u3048\u3070\u3001\u8a18\u4e8b\u672c\u6587\u306e\u4e0b\u306b\u95a2\u9023\u8a18\u4e8b\u3092\u51fa\u3059\u3001\u30c8\u30c3\u30d7\u30da\u30fc\u30b8\u306e\u4e00\u90e8\u306b\u304a\u77e5\u3089\u305b\u3092\u51fa\u3059\u3001\u30b5\u30a4\u30c9\u30d0\u30fc\u306b\u6700\u65b0\u8a18\u4e8b\u3092\u51fa\u3059\u3001\u3068\u3044\u3063\u305f\u5834\u9762\u3067\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<h2 id=\"what-is-custom-query\" class=\"h-underline section-heading\"><span class=\"section-heading-icon\" aria-hidden=\"true\"><svg data-wpq-icon=\"lightbulb\" 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 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5\" \/>\n  <path d=\"M9 18h6\" \/>\n  <path d=\"M10 22h4\" \/>\n<\/svg><\/span><span class=\"section-heading-text\">custom query \u306f\u4f55\u3092\u6307\u3059\u8a00\u8449\u304b<\/span><\/h2>\n<p>custom query \u306f\u3001\u958b\u767a\u8005\u304c\u72ec\u81ea\u306b\u6761\u4ef6\u3092\u6307\u5b9a\u3057\u3066\u4f5c\u308b\u6295\u7a3f\u53d6\u5f97\u30af\u30a8\u30ea\u3067\u3059\u3002WordPress \u306e\u516c\u5f0f\u95a2\u6570\u540d\u305d\u306e\u3082\u306e\u3068\u3044\u3046\u3088\u308a\u3001main query \u3068\u306f\u5225\u306b\u4f5c\u308b\u72ec\u81ea\u306e `WP_Query` \u3092\u6307\u3059\u8aac\u660e\u8a9e\u3068\u3057\u3066\u4f7f\u308f\u308c\u308b\u3053\u3068\u304c\u591a\u3044\u8a00\u8449\u3067\u3059\u3002<\/p>\n<p>\u5b9f\u88c5\u3067\u306f\u3001`new WP_Query( $args )` \u306e\u5f62\u3067\u4f5c\u308a\u307e\u3059\u3002`$args` \u306b\u306f\u3001\u6295\u7a3f\u30bf\u30a4\u30d7\u3001\u4ef6\u6570\u3001\u6295\u7a3f\u30b9\u30c6\u30fc\u30bf\u30b9\u3001\u30ab\u30c6\u30b4\u30ea\u30fc\u6761\u4ef6\u3001\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u6761\u4ef6\u3001\u65e5\u4ed8\u6761\u4ef6\u306a\u3069\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u3053\u3067\u5927\u4e8b\u306a\u306e\u306f\u3001custom query \u306f\u300c\u8ffd\u52a0\u306e\u4e00\u89a7\u300d\u3092\u4f5c\u308b\u305f\u3081\u306b\u4f7f\u3046\u3053\u3068\u304c\u591a\u3044\u3068\u3044\u3046\u70b9\u3067\u3059\u3002\u30da\u30fc\u30b8\u672c\u4f53\u306e\u30a2\u30fc\u30ab\u30a4\u30d6\u4e00\u89a7\u305d\u306e\u3082\u306e\u3092\u5909\u3048\u305f\u3044\u5834\u5408\u306f\u3001main query \u306e\u8abf\u6574\u3082\u691c\u8a0e\u3057\u307e\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a\u3001\u300c\u4eca\u3042\u308b\u4e00\u89a7\u3092\u5909\u3048\u305f\u3044\u300d\u306e\u304b\u300c\u5225\u306e\u4e00\u89a7\u3092\u8ffd\u52a0\u3057\u305f\u3044\u300d\u306e\u304b\u3092\u5148\u306b\u5206\u3051\u307e\u3059\u3002\u524d\u8005\u306f main query\u3001\u5f8c\u8005\u306f custom query \u304c\u5019\u88dc\u306b\u306a\u308a\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: \u8a00\u8449 \/ \u610f\u5473 \/ \u4f7f\u3046\u5834\u9762\"><table class=\"article-table table-priority wpq-article-table\"><thead><tr><th>\u8a00\u8449<\/th><th>\u610f\u5473<\/th><th>\u4f7f\u3046\u5834\u9762<\/th><\/tr><\/thead><tbody><tr><td>main query<\/td><td>WordPress \u304c\u73fe\u5728\u30da\u30fc\u30b8\u7528\u306b\u81ea\u52d5\u3067\u7528\u610f\u3059\u308b\u4e3b\u8981\u30af\u30a8\u30ea<\/td><td>\u30a2\u30fc\u30ab\u30a4\u30d6\u3001\u691c\u7d22\u7d50\u679c\u3001\u6295\u7a3f\u8a73\u7d30\u306a\u3069\u30da\u30fc\u30b8\u672c\u4f53<\/td><\/tr><tr><td>custom query<\/td><td>\u958b\u767a\u8005\u304c\u8ffd\u52a0\u3067\u4f5c\u308b\u72ec\u81ea\u30af\u30a8\u30ea<\/td><td>\u95a2\u9023\u8a18\u4e8b\u3001\u6700\u65b0\u8a18\u4e8b\u3001\u30b5\u30a4\u30c9\u30d0\u30fc\u4e00\u89a7\u306a\u3069<\/td><\/tr><tr><td>The Loop<\/td><td>\u53d6\u5f97\u3057\u305f\u6295\u7a3f\u30921\u4ef6\u305a\u3064\u8868\u793a\u3059\u308b\u51e6\u7406<\/td><td>main query \u3084 custom query \u306e\u7d50\u679c\u3092\u8868\u793a\u3059\u308b<\/td><\/tr><tr><td><code>wp_reset_postdata()<\/code><\/td><td>\u72ec\u81ea\u30af\u30a8\u30ea\u5f8c\u306b\u6295\u7a3f\u30c7\u30fc\u30bf\u3092\u623b\u3059\u51e6\u7406<\/td><td>custom query \u306e\u5f8c<\/td><\/tr><\/tbody><\/table><\/div><\/div>\n<h2 id=\"main-query-vs-custom-query\" class=\"h-underline section-heading\"><span class=\"section-heading-icon\" aria-hidden=\"true\"><svg data-wpq-icon=\"refresh\" 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=\"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8\" \/>\n  <path d=\"M21 3v5h-5\" \/>\n  <path d=\"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16\" \/>\n  <path d=\"M8 16H3v5\" \/>\n<\/svg><\/span><span class=\"section-heading-text\">main query \u3068\u306e\u9055\u3044<\/span><\/h2>\n<p>main query \u306f\u3001WordPress \u304c\u73fe\u5728\u306e\u30da\u30fc\u30b8\u672c\u4f53\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306b\u81ea\u52d5\u3067\u7528\u610f\u3059\u308b\u30af\u30a8\u30ea\u3067\u3059\u3002custom query \u306f\u3001\u958b\u767a\u8005\u304c\u8ffd\u52a0\u3067\u4f5c\u308b\u5225\u306e\u30af\u30a8\u30ea\u3067\u3059\u3002<\/p>\n<p>\u305f\u3068\u3048\u3070\u3001\u30ab\u30c6\u30b4\u30ea\u30fc\u30a2\u30fc\u30ab\u30a4\u30d6\u3067\u8868\u793a\u3055\u308c\u308b\u8a18\u4e8b\u4e00\u89a7\u306f main query \u3067\u3059\u3002\u305d\u306e\u30da\u30fc\u30b8\u306e\u4e0b\u306b\u300c\u304a\u3059\u3059\u3081\u8a18\u4e8b\u30923\u4ef6\u300d\u51fa\u3059\u5834\u5408\u3001\u305d\u306e\u304a\u3059\u3059\u3081\u8a18\u4e8b\u306f custom query \u3067\u4f5c\u308b\u5019\u88dc\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u65e2\u5b58\u30a2\u30fc\u30ab\u30a4\u30d6\u306e\u8868\u793a\u4ef6\u6570\u3084\u4e26\u3073\u9806\u3092\u5909\u3048\u305f\u3044\u5834\u5408\u3001custom query \u3067\u4f5c\u308a\u76f4\u3059\u3068\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u304c\u305a\u308c\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002\u305d\u306e\u3088\u3046\u306a\u5834\u5408\u306f\u3001main query \u3092\u8abf\u6574\u3059\u308b\u65b9\u91dd\u3092\u5148\u306b\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<p>\u4e00\u65b9\u3001\u8a18\u4e8b\u672c\u6587\u306e\u9014\u4e2d\u3084\u30b5\u30a4\u30c9\u30d0\u30fc\u306b\u5225\u306e\u4e00\u89a7\u3092\u8ffd\u52a0\u3059\u308b\u5834\u5408\u306f\u3001custom query \u304c\u5206\u304b\u308a\u3084\u3059\u3044\u9078\u629e\u80a2\u306b\u306a\u308a\u307e\u3059\u3002\u30da\u30fc\u30b8\u672c\u4f53\u3068\u306f\u5225\u306e\u30af\u30a8\u30ea\u3068\u3057\u3066\u7ba1\u7406\u3067\u304d\u308b\u304b\u3089\u3067\u3059\u3002<\/p>\n<h2 id=\"builder\" class=\"h-underline section-heading\"><span class=\"section-heading-icon\" aria-hidden=\"true\"><svg data-wpq-icon=\"builder\" 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\">Builder \u3067\u306e\u6271\u3044<\/span><\/h2>\n<p>WP Query Builder \u3067\u306f\u3001custom query \u306f\u300c\u65b0\u3057\u3044\u6295\u7a3f\u4e00\u89a7\u3092\u8ffd\u52a0\u3059\u308b\u300d\u305f\u3081\u306e\u751f\u6210\u30b3\u30fc\u30c9\u3068\u3057\u3066\u6271\u3046\u60f3\u5b9a\u3067\u3059\u3002\u30e6\u30fc\u30b6\u30fc\u304c\u9078\u3093\u3060\u6761\u4ef6\u3092 `$args` \u306b\u307e\u3068\u3081\u3001`new WP_Query()` \u3068\u72ec\u81ea\u30eb\u30fc\u30d7\u306e\u5f62\u3067\u51fa\u529b\u3057\u307e\u3059\u3002<\/p>\n<p>\u4e00\u65b9\u3001\u300c\u65e2\u5b58\u306e\u30ab\u30c6\u30b4\u30ea\u30fc\u30a2\u30fc\u30ab\u30a4\u30d6\u3084\u691c\u7d22\u7d50\u679c\u3092\u5909\u3048\u305f\u3044\u300d\u3068\u3044\u3046\u76ee\u7684\u3067\u306f\u3001custom query \u3067\u306f\u306a\u304f main query \u306e\u8abf\u6574\u3092\u6848\u5185\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002Builder \u3067\u306f\u3001\u6700\u521d\u306b\u76ee\u7684\u3092\u5206\u3051\u308b\u3068\u8aa4\u7528\u3092\u6e1b\u3089\u305b\u307e\u3059\u3002<\/p>\n<p>\u751f\u6210\u30b3\u30fc\u30c9\u3067\u306f\u3001`wp_reset_postdata()` \u3092\u542b\u3081\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002\u521d\u5fc3\u8005\u304c\u30b3\u30d4\u30fc\u3057\u3066\u4f7f\u3046\u30b3\u30fc\u30c9\u3067\u306f\u3001\u72ec\u81ea\u30af\u30a8\u30ea\u5f8c\u306e\u623b\u3057\u51e6\u7406\u3092\u7701\u7565\u3057\u306a\u3044\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<h2 id=\"practical-article\" 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\">\u4f7f\u3044\u3069\u3053\u308d\u30fb\u907f\u3051\u3069\u3053\u308d\u3068\u5b9f\u8df5\u78ba\u8a8d<\/span><\/h2>\n<p>\u30e1\u30a4\u30f3\u30af\u30a8\u30ea\u3068\u306f\u5225\u306b\u3001\u95a2\u9023\u8a18\u4e8b\u3084\u4efb\u610f\u306e\u4e00\u89a7\u306a\u3069\u72ec\u7acb\u3057\u305f\u6295\u7a3f\u96c6\u5408\u304c\u5fc5\u8981\u306a\u6642\u306b\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<p>\u73fe\u5728\u306e\u30a2\u30fc\u30ab\u30a4\u30d6\u3084\u691c\u7d22\u7d50\u679c\u305d\u306e\u3082\u306e\u3092\u5909\u3048\u305f\u3044\u5834\u5408\u306f\u3001\u5225\u306e `WP_Query` \u3092\u5897\u3084\u3055\u305a\u30e1\u30a4\u30f3\u30af\u30a8\u30ea\u306e\u8abf\u6574\u3092\u691c\u8a0e\u3057\u307e\u3059\u3002<\/p>\n<p>`the_post()` \u3092\u4f7f\u3046\u72ec\u81ea\u30eb\u30fc\u30d7\u306f\u30b0\u30ed\u30fc\u30d0\u30eb `$post` \u3092\u52d5\u304b\u3059\u305f\u3081\u3001\u5f8c\u7d9a\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3078\u623b\u3059\u51e6\u7406\u307e\u3067\u3092\u4e00\u9023\u306e\u5b9f\u88c5\u3068\u3057\u3066\u6271\u3044\u307e\u3059\u3002<\/p>\n<p>\u30da\u30fc\u30b8\u672c\u4f53\u306e\u4e00\u89a7\u3092\u5909\u3048\u308b\u306e\u304b\u3001\u5225\u67a0\u306e\u4e00\u89a7\u3092\u8db3\u3059\u306e\u304b\u3092\u5206\u3051\u308b\u3068\u3001\u30e1\u30a4\u30f3\u30af\u30a8\u30ea\u3092\u58ca\u3055\u305a\u306b\u6e08\u307f\u307e\u3059\u3002<\/p>\n<p>\u72ec\u81ea\u30eb\u30fc\u30d7\u306e\u524d\u30fb\u4e2d\u30fb\u5f8c\u3067\u6295\u7a3fID\u3068\u30bf\u30a4\u30c8\u30eb\u3092\u51fa\u529b\u3057\u3001\u30ea\u30bb\u30c3\u30c8\u5f8c\u306b\u5143\u306e\u30da\u30fc\u30b8\u6587\u8108\u3078\u623b\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<a class=\"deep-link-card wpq-related-link wpq-related-link--internal\" href=\"https:\/\/wptoolslab.com\/query-lab\/articles\/wp-reset-postdata-reason\/\"><span class=\"article-thumb wpq-related-link__thumb\"><img decoding=\"async\" alt=\"wp_reset_postdata()\u306f\u3044\u3064\u5fc5\u8981\uff1f\u4f7f\u3044\u65b9\u30fb\u66f8\u304f\u5834\u6240\u30fb\u4e0d\u8981\u306a\u30b1\u30fc\u30b9 \u306e\u30b5\u30e0\u30cd\u30a4\u30eb\" src=\"https:\/\/wptoolslab.com\/query-lab\/wp-content\/uploads\/2026\/08\/wp-reset-postdata-reason-card.png\" loading=\"lazy\" \/><\/span><div class=\"deep-link-copy wpq-related-link__copy\"><small>\u5b9f\u8df5\u8a18\u4e8b\u3067\u78ba\u8a8d<\/small><b>wp_reset_postdata()\u304c\u5fc5\u8981\u306a\u7406\u7531<\/b><p>\u72ec\u81ea\u30eb\u30fc\u30d7\u5f8c\u306b\u30bf\u30a4\u30c8\u30eb\u3084\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30bf\u30b0\u304c\u305a\u308c\u308b\u7406\u7531\u3092\u3001`wp_reset_postdata()` \u306e\u5b9f\u4f8b\u3067\u8ffd\u3048\u307e\u3059\u3002<\/p><span class=\"jump\"><span>\u8a18\u4e8b\u3092\u8aad\u3080 \u2192<\/span><\/span><\/div><\/a>\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\">WordPress\u306e\u4ed5\u69d8\u3067\u78ba\u8a8d\u3059\u308b\u30dd\u30a4\u30f3\u30c8<\/span><\/h2>\n<p>\u516c\u5f0f\u8cc7\u6599\u3067\u306f\u3001WP_Query Class \u3067\u53d6\u5f97\u6761\u4ef6\u3084\u72ec\u81ea\u30af\u30a8\u30ea\u306e\u69cb\u9020\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002The Loop \u3067\u306f\u3001\u53d6\u5f97\u3057\u305f\u6295\u7a3f\u3092\u8868\u793a\u3059\u308b\u57fa\u672c\u306e\u6d41\u308c\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>custom query \u3067\u306f\u3001`wp_reset_postdata()` \u3082\u91cd\u8981\u3067\u3059\u3002\u72ec\u81ea\u30eb\u30fc\u30d7\u5f8c\u306b\u6295\u7a3f\u30c7\u30fc\u30bf\u3092\u623b\u3059\u51e6\u7406\u3068\u3057\u3066\u3001\u516c\u5f0f\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u3092\u5408\u308f\u305b\u3066\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\">custom query \u306e\u53d6\u5f97\u6761\u4ef6\u3084\u57fa\u672c\u69cb\u9020\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\/themes\/basics\/the-loop\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span class=\"wpq-reference-item__copy\"><strong class=\"wpq-reference-item__title\">The Loop<\/strong><span class=\"wpq-reference-item__description\">\u53d6\u5f97\u3057\u305f\u6295\u7a3f\u3092\u30eb\u30fc\u30d7\u3067\u8868\u793a\u3059\u308b\u6d41\u308c\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\/wp_reset_postdata\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span class=\"wpq-reference-item__copy\"><strong class=\"wpq-reference-item__title\">wp_reset_postdata()<\/strong><span class=\"wpq-reference-item__description\">\u72ec\u81ea\u30af\u30a8\u30ea\u5f8c\u306b\u6295\u7a3f\u30c7\u30fc\u30bf\u3092\u623b\u3059\u51e6\u7406\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<p>custom query \u306f\u3001WordPress \u306e main query \u3068\u306f\u5225\u306b\u3001\u958b\u767a\u8005\u304c\u72ec\u81ea\u306b\u4f5c\u308b\u6295\u7a3f\u53d6\u5f97\u30af\u30a8\u30ea\u3067\u3059\u3002\u95a2\u9023\u8a18\u4e8b\u3084\u6700\u65b0\u8a18\u4e8b\u306a\u3069\u3001\u8ffd\u52a0\u306e\u4e00\u89a7\u3092\u4f5c\u308b\u6642\u306b\u5411\u3044\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u8ff7\u3063\u305f\u6642\u306f\u3001\u65e2\u5b58\u4e00\u89a7\u3092\u5909\u3048\u305f\u3044\u306e\u304b\u3001\u8ffd\u52a0\u4e00\u89a7\u3092\u4f5c\u308a\u305f\u3044\u306e\u304b\u3092\u5148\u306b\u5206\u3051\u307e\u3059\u3002\u8ffd\u52a0\u4e00\u89a7\u306a\u3089 custom query\u3001\u65e2\u5b58\u4e00\u89a7\u306a\u3089 main query \u306e\u8abf\u6574\u3092\u691c\u8a0e\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>custom query \u306e\u6700\u7d42\u30c1\u30a7\u30c3\u30af<\/h2><\/div><ul class=\"wpq-checklist\"><li>custom query \u306f main query \u3068\u306f\u5225\u306b\u4f5c\u308b\u72ec\u81ea\u30af\u30a8\u30ea\u3060\u3068\u7406\u89e3\u3057\u3066\u3044\u308b<\/li><li>\u8ffd\u52a0\u4e00\u89a7\u3092\u4f5c\u308a\u305f\u3044\u5834\u9762\u304b\u78ba\u8a8d\u3057\u305f<\/li><li>\u65e2\u5b58\u4e00\u89a7\u3092\u5909\u3048\u308b\u5834\u5408\u306f main query \u306e\u8abf\u6574\u3082\u691c\u8a0e\u3057\u305f<\/li><li>\u72ec\u81ea\u30eb\u30fc\u30d7\u3067\u306f <code>$query-&gt;have_posts()<\/code> \u3068 <code>$query-&gt;the_post()<\/code> \u3092\u4f7f\u3063\u3066\u3044\u308b<\/li><li>\u30eb\u30fc\u30d7\u5f8c\u306b <code>wp_reset_postdata()<\/code> \u3092\u5165\u308c\u3066\u3044\u308b<\/li><li>\u307e\u305a\u306f1\u4ef6\u3060\u3051\u306e\u6700\u5c0f\u69cb\u6210\u3067\u8868\u793a\u78ba\u8a8d\u3057\u305f<\/li><\/ul><\/section>\n","protected":false},"excerpt":{"rendered":"<p>custom query \u306f\u3001WordPress \u304c\u81ea\u52d5\u3067\u7528\u610f\u3059\u308b main query \u3068\u306f\u5225\u306b\u3001\u958b\u767a\u8005\u304c\u72ec\u81ea\u306b\u4f5c\u308b\u6295\u7a3f\u53d6\u5f97\u30af\u30a8\u30ea\u3067\u3059\u3002\u95a2\u9023\u8a18\u4e8b\u3084\u5225\u67a0\u306e\u6700\u65b0\u8a18\u4e8b\u4e00\u89a7\u306a\u3069\u3067\u4f7f\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"author":2,"featured_media":3777,"template":"","meta":{"wpq_kicker":"\u7528\u8a9e\u96c6","wpq_lead":"custom query \u306f\u3001WordPress \u306e main query \u3068\u306f\u5225\u306b\u3001\u958b\u767a\u8005\u304c\u72ec\u81ea\u306b\u4f5c\u308b\u6295\u7a3f\u53d6\u5f97\u7528\u306e\u30af\u30a8\u30ea\u3067\u3059\u3002new WP_Query() \u3067\u6761\u4ef6\u3092\u6307\u5b9a\u3057\u3001\u53d6\u5f97\u3057\u305f\u6295\u7a3f\u3092\u72ec\u81ea\u306e The Loop \u3067\u8868\u793a\u3057\u307e\u3059\u3002","wpq_hero_title_line1":"WP_Query \u7528\u8a9e","wpq_hero_title_line2":"custom query","wpq_hero_title_accent":"custom query","wpq_hero_thumbnail_alt":"custom query \u306e\u6982\u8981\u30a4\u30e1\u30fc\u30b8","wpq_hero_summary_mode":"","wpq_hero_summary_label":"","wpq_hero_summary_items":"","wpq_reading_time":"","wpq_updated_label":"","wpq_official_links":"WP_Query Class|https:\/\/developer.wordpress.org\/reference\/classes\/wp_query\/\nThe Loop|https:\/\/developer.wordpress.org\/themes\/basics\/the-loop\/\nwp_reset_postdata()|https:\/\/developer.wordpress.org\/reference\/functions\/wp_reset_postdata\/","wpq_update_history":"","wpq_pr_notice":"","footnotes":""},"wpq_glossary_group":[62],"wpq_glossary_attribute":[37],"class_list":["post-433","wpq_glossary","type-wpq_glossary","status-publish","has-post-thumbnail","hentry"],"_links":{"self":[{"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_glossary\/433","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_glossary"}],"about":[{"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/types\/wpq_glossary"}],"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_glossary\/433\/revisions"}],"predecessor-version":[{"id":4002,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_glossary\/433\/revisions\/4002"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/media\/3777"}],"wp:attachment":[{"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/media?parent=433"}],"wp:term":[{"taxonomy":"wpq_glossary_group","embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_glossary_group?post=433"},{"taxonomy":"wpq_glossary_attribute","embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_glossary_attribute?post=433"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}