{"id":281,"date":"2026-08-15T15:45:58","date_gmt":"2026-08-15T06:45:58","guid":{"rendered":"https:\/\/wptoolslab.com\/query-lab\/?post_type=wpq_article&amp;p=281"},"modified":"2026-11-04T20:01:31","modified_gmt":"2026-11-04T11:01:31","slug":"wp-query-basics","status":"publish","type":"wpq_article","link":"https:\/\/wptoolslab.com\/query-lab\/articles\/wp-query-basics\/","title":{"rendered":"WP_Query\u3068\u306f\uff1f\u521d\u5fc3\u8005\u5411\u3051\u306b\u5f79\u5272\u3068\u4f7f\u3044\u65b9\u3092\u89e3\u8aac"},"content":{"rendered":"<section class=\"conclusion wpq-conclusion\"><h2 class=\"wpq-conclusion__title\">WP_Query\u306e\u5f79\u5272<\/h2><p>WP_Query\u306f\u3001WordPress\u304c\u300c\u3069\u306e\u6295\u7a3f\u3092\u8868\u793a\u3059\u308b\u304b\u300d\u3092\u6271\u3046\u30af\u30e9\u30b9\u3067\u3059\u3002WordPress\u81ea\u8eab\u304c\u73fe\u5728\u306eURL\u306b\u5408\u3046\u6295\u7a3f\u3092\u9078\u3076\u6642\u306b\u3082\u3001\u30c6\u30fc\u30de\u3084\u30d7\u30e9\u30b0\u30a4\u30f3\u304c\u8ffd\u52a0\u306e\u4e00\u89a7\u3092\u4f5c\u308b\u6642\u306b\u3082\u4f7f\u308f\u308c\u307e\u3059\u3002<\/p>\n<p>\u81ea\u5206\u3067\u4e00\u89a7\u3092\u4f5c\u308b\u5834\u5408\u306f\u3001\u53d6\u5f97\u6761\u4ef6\u3092`$args`\u3078\u66f8\u304d\u3001`new WP_Query()`\u3078\u6e21\u3057\u307e\u3059\u3002\u8fd4\u3063\u3066\u304d\u305f\u6295\u7a3f\u3092\u30eb\u30fc\u30d7\u3067\u8868\u793a\u3057\u3001`the_post()`\u3092\u4f7f\u3063\u305f\u5f8c\u306f`wp_reset_postdata()`\u3067\u5143\u306e\u6295\u7a3f\u30c7\u30fc\u30bf\u3078\u623b\u3059\u3001\u3068\u3044\u3046\u306e\u304c\u57fa\u672c\u306e\u6d41\u308c\u3067\u3059\u3002<\/p>\n<\/section>\n<h2 id=\"what-is-wp-query\" 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\">WP_Query\u304c\u62c5\u5f53\u3059\u308b\u3053\u3068<\/span><\/h2>\n<p>WordPress\u306f\u3001\u30c8\u30c3\u30d7\u30da\u30fc\u30b8\u3001\u30ab\u30c6\u30b4\u30ea\u30fc\u4e00\u89a7\u3001\u691c\u7d22\u7d50\u679c\u306a\u3069\u3092\u958b\u304f\u3068\u3001URL\u3084\u8a2d\u5b9a\u306b\u5408\u3046\u6295\u7a3f\u3092\u5148\u306b\u53d6\u5f97\u3057\u307e\u3059\u3002\u3053\u306e\u30da\u30fc\u30b8\u672c\u6765\u306e\u8868\u793a\u306b\u4f7f\u3046\u3082\u306e\u304c\u30e1\u30a4\u30f3\u30af\u30a8\u30ea\u3067\u3059\u3002\u901a\u5e38\u306e\u4e00\u89a7\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067\u306f\u3001\u3059\u3067\u306b\u7528\u610f\u3055\u308c\u305f\u30e1\u30a4\u30f3\u30af\u30a8\u30ea\u3092\u30eb\u30fc\u30d7\u3067\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n<p>\u4e00\u65b9\u3001\u8a18\u4e8b\u4e0b\u306e\u95a2\u9023\u8a18\u4e8b\u3084\u30c8\u30c3\u30d7\u30da\u30fc\u30b8\u306e\u30a4\u30d9\u30f3\u30c8\u4e00\u89a7\u306a\u3069\u3001\u672c\u6765\u306e\u8868\u793a\u3068\u306f\u5225\u306e\u6295\u7a3f\u304c\u5fc5\u8981\u306a\u5834\u5408\u306f\u3001\u81ea\u5206\u3067`new WP_Query()`\u3092\u4f7f\u3063\u3066\u72ec\u81ea\u306e\u30af\u30a8\u30ea\u3092\u4f5c\u308c\u307e\u3059\u3002<\/p>\n<span class=\"wpq-marker wpq-marker--yellow\">WP_Query\u306f\u3001\u6295\u7a3f\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306e\u30c7\u30b6\u30a4\u30f3\u90e8\u54c1\u3067\u306f\u306a\u304f\u3001\u8868\u793a\u3059\u308b\u6295\u7a3f\u3092\u9078\u3076\u305f\u3081\u306e\u4ed5\u7d44\u307f\u3067\u3059\u3002<\/span>\n<p>\u898b\u305f\u76ee\u3092\u6574\u3048\u308b\u306e\u306f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3068CSS\u3001\u6295\u7a3f\u3092\u9078\u3076\u306e\u306fWP_Query\u3067\u3059\u3002\u53d6\u5f97\u3068\u8868\u793a\u3092\u5206\u3051\u3066\u8003\u3048\u308b\u3068\u3001\u76f4\u3059\u5834\u6240\u3082\u5224\u65ad\u3057\u3084\u3059\u304f\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: \u3088\u304f\u3042\u308b\u601d\u3044\u8fbc\u307f \/ \u5b9f\u969b\u306e\u5f79\u5272\"><table class=\"article-table table-priority wpq-article-table\"><thead><tr><th>\u3088\u304f\u3042\u308b\u601d\u3044\u8fbc\u307f<\/th><th>\u5b9f\u969b\u306e\u5f79\u5272<\/th><\/tr><\/thead><tbody><tr><td>\u4e00\u89a7\u30da\u30fc\u30b8\u3067\u306f\u6bce\u56denew WP_Query()\u3092\u66f8\u304f<\/td><td>\u901a\u5e38\u306e\u4e00\u89a7\u306fWordPress\u304c\u7528\u610f\u3057\u305f\u30e1\u30a4\u30f3\u30af\u30a8\u30ea\u3092\u4f7f\u3046<\/td><\/tr><tr><td>WP_Query\u3092\u66f8\u3051\u3070\u898b\u305f\u76ee\u307e\u3067\u6574\u3046<\/td><td>WP_Query\u306f\u6295\u7a3f\u3092\u53d6\u5f97\u3057\u3001\u898b\u305f\u76ee\u306f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3068CSS\u3067\u6574\u3048\u308b<\/td><\/tr><tr><td>the_post()\u3060\u3051\u3067\u8868\u793a\u3067\u304d\u308b<\/td><td>have_posts()\u3067\u78ba\u8a8d\u3057\u3001the_post()\u3067\u9032\u3081\u3001\u72ec\u81ea\u30eb\u30fc\u30d7\u5f8c\u306fwp_reset_postdata()\u3067\u623b\u3059<\/td><\/tr><\/tbody><\/table><\/div><\/div>\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\/main-query-vs-secondary-query\/\"><span class=\"article-thumb wpq-related-link__thumb\"><img decoding=\"async\" alt=\"\u30e1\u30a4\u30f3\u30af\u30a8\u30ea\u3068\u30b5\u30d6\u30af\u30a8\u30ea\u306e\u9055\u3044\u3092\u56f3\u3067\u7406\u89e3\u3059\u308b\" src=\"https:\/\/wptoolslab.com\/query-lab\/wp-content\/uploads\/2026\/09\/main-query-vs-secondary-query-card.png\" loading=\"lazy\" \/><\/span><div class=\"deep-link-copy wpq-related-link__copy\"><small>\u8a73\u3057\u3044\u89e3\u8aac<\/small><b>\u30e1\u30a4\u30f3\u30af\u30a8\u30ea\u3068\u30b5\u30d6\u30af\u30a8\u30ea\u306e\u9055\u3044\u3092\u56f3\u3067\u7406\u89e3\u3059\u308b<\/b><span class=\"jump\"><span>\u8a18\u4e8b\u3092\u8aad\u3080<\/span><\/span><\/div><\/a><\/div>\n<h2 id=\"when-to-use\" 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\">WP_Query\u3092\u4f7f\u3046\u5834\u9762<\/span><\/h2>\n<p>WP_Query\u306f\u3001WordPress\u306e\u901a\u5e38\u306e\u8868\u793a\u3060\u3051\u3067\u306f\u8db3\u308a\u306a\u3044\u3068\u304d\u306b\u4f7f\u3044\u307e\u3059\u3002\u4f55\u3067\u3082WP_Query\u3067\u66f8\u304d\u76f4\u3059\u3082\u306e\u3067\u306f\u306a\u304f\u3001\u300c\u4eca\u306e\u30da\u30fc\u30b8\u3068\u306f\u5225\u6761\u4ef6\u306e\u8a18\u4e8b\u4e00\u89a7\u3092\u4f5c\u308a\u305f\u3044\u300d\u3068\u304d\u306b\u4f7f\u3046\u3001\u3068\u8003\u3048\u308b\u3068\u5224\u65ad\u3057\u3084\u3059\u3044\u3067\u3059\u3002<\/p>\n<p>\u305f\u3068\u3048\u3070\u3001\u8a18\u4e8b\u4e0b\u306b\u540c\u3058\u30ab\u30c6\u30b4\u30ea\u30fc\u306e\u95a2\u9023\u8a18\u4e8b\u30923\u4ef6\u51fa\u3059\u3001\u30c8\u30c3\u30d7\u30da\u30fc\u30b8\u3067\u65b0\u7740\u60c5\u5831\u3068\u30a4\u30d9\u30f3\u30c8\u60c5\u5831\u3092\u5206\u3051\u308b\u3001\u3068\u3044\u3063\u305f\u5834\u9762\u3067\u3059\u3002\u3053\u306e\u5834\u5408\u306f`posts_per_page`\u3067\u4ef6\u6570\u3001`post_type`\u3067\u6295\u7a3f\u30bf\u30a4\u30d7\u3001\u30ab\u30c6\u30b4\u30ea\u30fc\u3084\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u306e\u5f15\u6570\u3067\u7d5e\u308a\u8fbc\u307f\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>\u305f\u3060\u3057\u3001\u3059\u3067\u306bWordPress\u304c\u7528\u610f\u3057\u3066\u3044\u308b\u30e1\u30a4\u30f3\u30af\u30a8\u30ea\u306e\u4e00\u89a7\u3092\u5909\u3048\u305f\u3044\u5834\u5408\u306f\u3001WP_Query\u3092\u65b0\u3057\u304f\u4f5c\u308b\u306e\u3067\u306f\u306a\u304f\u3001`pre_get_posts`\u3067\u5bfe\u8c61\u3092\u9650\u5b9a\u3057\u3066\u8abf\u6574\u3059\u308b\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002\u6700\u521d\u306f\u3001\u30b5\u30a4\u30c9\u30d0\u30fc\u3084\u8a18\u4e8b\u4e0b\u306a\u3069\u306b\u300c\u8ffd\u52a0\u306e\u4e00\u89a7\u300d\u3092\u4f5c\u308b\u5834\u9762\u304b\u3089\u8a66\u3059\u3068\u3001\u30e1\u30a4\u30f3\u30af\u30a8\u30ea\u3068\u306e\u5f79\u5272\u3092\u5206\u3051\u3066\u7406\u89e3\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2 id=\"basic-structure\" 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\">WP_Query\u306e\u57fa\u672c\u69cb\u9020<\/span><\/h2>\n<p>\u3053\u3053\u3067\u306f\u3001WP_Query\u306e\u5168\u4f53\u306e\u6d41\u308c\u3068\u3001\u305d\u308c\u305e\u308c\u306e\u51e6\u7406\u304c\u62c5\u5f53\u3059\u308b\u5f79\u5272\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<p>WP_Query\u306e\u57fa\u672c\u306f\u3001\u6761\u4ef6\u3092\u914d\u5217\u3067\u7528\u610f\u3057\u3001\u305d\u306e\u6761\u4ef6\u3092 `new WP_Query()` \u306b\u6e21\u3059\u5f62\u3067\u3059\u3002\u305d\u306e\u5f8c\u3001\u53d6\u5f97\u3057\u305f\u6295\u7a3f\u304c\u3042\u308b\u304b\u3092 `have_posts()` \u3067\u78ba\u8a8d\u3057\u3001\u6295\u7a3f\u304c\u3042\u308b\u9593\u3060\u3051 `the_post()` \u30671\u4ef6\u305a\u3064\u53d6\u308a\u51fa\u3057\u307e\u3059\u3002<\/p>\n<p>`$args`\u3067\u6761\u4ef6\u3092\u4f5c\u308b\u3060\u3051\u3067\u306f\u753b\u9762\u306b\u306f\u4f55\u3082\u51fa\u307e\u305b\u3093\u3002\u53d6\u5f97\u7d50\u679c\u3092\u30eb\u30fc\u30d7\u3067\u56de\u3057\u3001\u30bf\u30a4\u30c8\u30eb\u3084\u30ea\u30f3\u30af\u3092\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30bf\u30b0\u3067\u51fa\u529b\u3057\u3066\u3001\u306f\u3058\u3081\u3066\u4e00\u89a7\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u5b9f\u969b\u306e`$args`\u3068\u30eb\u30fc\u30d7\u30921\u884c\u305a\u3064\u78ba\u8a8d\u3059\u308b\u6bb5\u968e\u3067\u306f\u3001[WP_Query\u306e\u57fa\u672c\u69cb\u6587](..\/wp-query-basic-syntax\/)\u3078\u9032\u3093\u3067\u304f\u3060\u3055\u3044\u3002\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u3082\u4f55\u3082\u51fa\u306a\u3044\u6642\u306f\u3001\u6761\u4ef6\u3092\u6e1b\u3089\u3059[\u6295\u7a3f\u304c\u8868\u793a\u3055\u308c\u306a\u3044\u6642\u306e\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8](..\/wp-query-no-posts-checklist\/)\u304c\u5207\u308a\u5206\u3051\u306e\u5165\u53e3\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3 id=\"minimum-example\" class=\"wpq-subheading\">\u6700\u65b0\u8a18\u4e8b\u30923\u4ef6\u3060\u3051\u53d6\u5f97\u3059\u308b\u6700\u5c0f\u4f8b<\/h3>\n<p>\u6b21\u306e\u30b3\u30fc\u30c9\u306f\u3001\u901a\u5e38\u306e\u6295\u7a3f\u3092\u6700\u65b0\u9806\u30673\u4ef6\u53d6\u5f97\u3057\u3001\u30bf\u30a4\u30c8\u30eb\u3092\u4e00\u89a7\u3068\u3057\u3066\u8868\u793a\u3059\u308b\u6700\u5c0f\u4f8b\u3067\u3059\u3002\u307e\u305a\u306f\u30ab\u30c6\u30b4\u30ea\u30fc\u3084\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u306a\u3069\u306e\u6761\u4ef6\u3092\u8db3\u3055\u305a\u3001\u5c11\u306a\u3044\u4ef6\u6570\u3067\u52d5\u304d\u3092\u78ba\u8a8d\u3059\u308b\u306e\u304c\u304a\u3059\u3059\u3081\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u4f8b\u3092`functions.php`\u304b\u3089\u547c\u3076\u5834\u5408\u306f\u3001\u95a2\u6570\u30fb\u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\u30fb\u30d5\u30c3\u30af\u3078\u7d44\u307f\u8fbc\u307f\u3001\u5b9f\u884c\u6761\u4ef6\u3068\u51fa\u529b\u4f4d\u7f6e\u3092\u6c7a\u3081\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\">latest-posts.php<\/span><span class=\"code-purpose wpq-code-pill\">\u6700\u65b0\u306e\u6295\u7a3f\u30923\u4ef6\u3060\u3051\u8868\u793a\u3059\u308bWP_Query\u306e\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: \u6700\u65b0\u306e\u6295\u7a3f\u30923\u4ef6\u3060\u3051\u8868\u793a\u3059\u308bWP_Query\u306e\u6700\u5c0f\u4f8b \/ latest-posts.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\">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\">$latest_posts<\/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\">$latest_posts<\/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;\/p&gt;<\/span><span class=\"wpq-code-line\">&lt;p&gt;   <span class=\"c-keyword\">while<\/span> ( <span class=\"c-var\">$latest_posts<\/span>-&gt;have_posts() ) {&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">      <span class=\"c-var\">$latest_posts<\/span>-&gt;the_post();&lt;\/p&gt;<\/span><span class=\"wpq-code-line\">&lt;p&gt;      <span class=\"c-keyword\">echo<\/span> <span class=\"c-str\">&#039;&lt;li&gt;&#039;<\/span>;&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">      <span class=\"c-keyword\">echo<\/span> <span class=\"c-str\">&#039;&lt;a href=&quot;&#039;<\/span> . esc_url( get_permalink() ) . <span class=\"c-str\">&#039;&quot;&gt;&#039;<\/span>;&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">      <span class=\"c-keyword\">echo<\/span> esc_html( get_the_title() );&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">      <span class=\"c-keyword\">echo<\/span> <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;\/li&gt;&#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-keyword\">echo<\/span> <span class=\"c-str\">&#039;&lt;\/ul&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$args = [&lt;br \/&gt;\n   &#039;post_type&#039;      =&gt; &#039;post&#039;,&lt;br \/&gt;\n   &#039;posts_per_page&#039; =&gt; 3,&lt;br \/&gt;\n];&lt;\/p&gt;\n&lt;p&gt;$latest_posts = new WP_Query( $args );&lt;\/p&gt;\n&lt;p&gt;if ( $latest_posts-&gt;have_posts() ) {&lt;br \/&gt;\n   echo &#039;&lt;ul&gt;&#039;;&lt;\/p&gt;\n&lt;p&gt;   while ( $latest_posts-&gt;have_posts() ) {&lt;br \/&gt;\n      $latest_posts-&gt;the_post();&lt;\/p&gt;\n&lt;p&gt;      echo &#039;&lt;li&gt;&#039;;&lt;br \/&gt;\n      echo &#039;&lt;a href=&quot;&#039; . esc_url( get_permalink() ) . &#039;&quot;&gt;&#039;;&lt;br \/&gt;\n      echo esc_html( get_the_title() );&lt;br \/&gt;\n      echo &#039;&lt;\/a&gt;&#039;;&lt;br \/&gt;\n      echo &#039;&lt;\/li&gt;&#039;;&lt;br \/&gt;\n   }&lt;\/p&gt;\n&lt;p&gt;   echo &#039;&lt;\/ul&gt;&#039;;&lt;br \/&gt;\n}&lt;\/p&gt;\n&lt;p&gt;wp_reset_postdata();&lt;br \/&gt;<\/textarea><\/div>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u306e\u8aad\u307f\u3069\u3053\u308d\u306f\u3001\u307e\u305a `$args` \u306b\u6761\u4ef6\u3092\u96c6\u3081\u3066\u3044\u308b\u70b9\u3067\u3059\u3002`post_type` \u306f\u53d6\u5f97\u5bfe\u8c61\u3001`posts_per_page` \u306f\u53d6\u5f97\u4ef6\u6570\u3067\u3059\u3002\u3053\u306e2\u3064\u3060\u3051\u3067\u3082\u3001WP_Query\u306e\u57fa\u672c\u7684\u306a\u8003\u3048\u65b9\u306f\u3064\u304b\u3081\u307e\u3059\u3002<\/p>\n<p>\u3082\u3046\u3072\u3068\u3064\u5927\u4e8b\u306a\u306e\u306f\u3001\u6700\u5f8c\u306e `wp_reset_postdata()` \u3067\u3059\u3002\u3053\u306e\u4f8b\u306e\u3088\u3046\u306b\u72ec\u81ea\u306eWP_Query\u3067 `the_post()` \u3092\u4f7f\u3046\u3068\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30bf\u30b0\u304c\u53c2\u7167\u3059\u308b\u6295\u7a3f\u30c7\u30fc\u30bf\u304c\u305d\u306e\u30af\u30a8\u30ea\u5074\u306b\u5207\u308a\u66ff\u308f\u308a\u307e\u3059\u3002\u30eb\u30fc\u30d7\u304c\u7d42\u308f\u3063\u305f\u3042\u3068\u306b\u30e1\u30a4\u30f3\u30af\u30a8\u30ea\u306e\u73fe\u5728\u306e\u6295\u7a3f\u30c7\u30fc\u30bf\u3078\u623b\u3057\u3001\u5f8c\u7d9a\u306e\u30bf\u30a4\u30c8\u30eb\u3084URL\u304c\u5225\u6295\u7a3f\u3092\u53c2\u7167\u3059\u308b\u306e\u3092\u9632\u304e\u307e\u3059\u3002<\/p>\n<h2 id=\"args-mental-model\" class=\"h-underline section-heading\"><span class=\"section-heading-icon\" aria-hidden=\"true\"><svg data-wpq-icon=\"list\" 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 5h.01\" \/>\n  <path d=\"M3 12h.01\" \/>\n  <path d=\"M3 19h.01\" \/>\n  <path d=\"M8 5h13\" \/>\n  <path d=\"M8 12h13\" \/>\n  <path d=\"M8 19h13\" \/>\n<\/svg><\/span><span class=\"section-heading-text\">$args\u306f\u53d6\u5f97\u6761\u4ef6\u3092\u307e\u3068\u3081\u308b\u5834\u6240<\/span><\/h2>\n<p>WP_Query\u3092\u4f7f\u3046\u3068\u304d\u306b\u3088\u304f\u51fa\u3066\u304f\u308b `$args` \u306f\u3001\u53d6\u5f97\u6761\u4ef6\u3092\u307e\u3068\u3081\u305f\u914d\u5217\u3067\u3059\u3002\u540d\u524d\u306f `$args` \u3067\u306a\u304f\u3066\u3082\u52d5\u304d\u307e\u3059\u304c\u3001WordPress\u306e\u30b5\u30f3\u30d7\u30eb\u3084\u89e3\u8aac\u3067\u306f `$args` \u3068\u3044\u3046\u540d\u524d\u304c\u3088\u304f\u4f7f\u308f\u308c\u307e\u3059\u3002<\/p>\n<p>\u6700\u521d\u306b\u899a\u3048\u308b\u3079\u304d\u306a\u306e\u306f\u3001\u3059\u3079\u3066\u306e\u5f15\u6570\u3092\u4e00\u5ea6\u306b\u899a\u3048\u3088\u3046\u3068\u3057\u306a\u3044\u3053\u3068\u3067\u3059\u3002WP_Query\u306b\u306f\u591a\u304f\u306e\u6761\u4ef6\u304c\u3042\u308a\u307e\u3059\u304c\u3001\u521d\u5fc3\u8005\u304c\u6700\u521d\u306b\u4f7f\u3046\u3082\u306e\u306f\u9650\u3089\u308c\u3066\u3044\u307e\u3059\u3002\u307e\u305a\u306f\u300c\u4f55\u3092\u300d\u300c\u4f55\u4ef6\u300d\u300c\u3069\u306e\u9806\u756a\u3067\u300d\u53d6\u5f97\u3059\u308b\u306e\u304b\u306b\u5206\u3051\u3066\u8003\u3048\u308b\u3068\u3001\u30b3\u30fc\u30c9\u304c\u8aad\u307f\u3084\u3059\u304f\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: \u8003\u3048\u308b\u3053\u3068 \/ \u4ee3\u8868\u7684\u306a\u5f15\u6570 \/ \u521d\u5fc3\u8005\u5411\u3051\u306e\u898b\u65b9\"><table class=\"article-table table-priority wpq-article-table\"><thead><tr><th>\u8003\u3048\u308b\u3053\u3068<\/th><th>\u4ee3\u8868\u7684\u306a\u5f15\u6570<\/th><th>\u521d\u5fc3\u8005\u5411\u3051\u306e\u898b\u65b9<\/th><\/tr><\/thead><tbody><tr><td>\u4f55\u3092\u53d6\u5f97\u3059\u308b\u304b<\/td><td>post_type<\/td><td>\u6295\u7a3f\u3001\u56fa\u5b9a\u30da\u30fc\u30b8\u3001\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u306a\u3069\u306e\u5bfe\u8c61\u3092\u6c7a\u3081\u308b<\/td><\/tr><tr><td>\u4f55\u4ef6\u53d6\u5f97\u3059\u308b\u304b<\/td><td>posts_per_page<\/td><td>\u4e00\u89a7\u306b\u51fa\u3059\u4ef6\u6570\u3092\u6c7a\u3081\u308b<\/td><\/tr><tr><td>\u3069\u3046\u4e26\u3079\u308b\u304b<\/td><td>orderby \/ order<\/td><td>\u65e5\u4ed8\u9806\u3001\u30bf\u30a4\u30c8\u30eb\u9806\u306a\u3069\u3092\u6c7a\u3081\u308b<\/td><\/tr><tr><td>\u3069\u306e\u6761\u4ef6\u3067\u7d5e\u308b\u304b<\/td><td>category_name \/ tax_query \/ meta_query<\/td><td>\u30ab\u30c6\u30b4\u30ea\u30fc\u3001\u5206\u985e\u3001\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u306a\u3069\u3067\u7d5e\u308b<\/td><\/tr><\/tbody><\/table><\/div><\/div>\n<p>\u3053\u306e\u3088\u3046\u306b\u5206\u3051\u308b\u3068\u3001\u8907\u96d1\u306aWP_Query\u3082\u5c11\u3057\u305a\u3064\u8aad\u3081\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u6700\u521d\u304b\u3089 `tax_query` \u3084 `meta_query` \u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3088\u308a\u3001`post_type` \u3068 `posts_per_page` \u3060\u3051\u306e\u5c0f\u3055\u306a\u4f8b\u3067\u52d5\u4f5c\u78ba\u8a8d\u3059\u308b\u3068\u3001\u3069\u306e\u6761\u4ef6\u3067\u7d50\u679c\u304c\u5909\u308f\u3063\u305f\u304b\u3092\u8ffd\u3044\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2 id=\"common-mistakes\" 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\">\u521d\u5fc3\u8005\u304c\u3088\u304f\u3064\u307e\u305a\u304f\u30dd\u30a4\u30f3\u30c8<\/span><\/h2>\n<p>WP_Query\u3067\u6700\u521d\u306b\u3064\u307e\u305a\u304d\u3084\u3059\u3044\u306e\u306f\u3001\u30b3\u30fc\u30c9\u306e\u66f8\u304d\u65b9\u305d\u306e\u3082\u306e\u3088\u308a\u3082\u3001\u3069\u306e\u90e8\u5206\u304c\u4f55\u3092\u62c5\u5f53\u3057\u3066\u3044\u308b\u304b\u304c\u5206\u304b\u3089\u306a\u304f\u306a\u308b\u3053\u3068\u3067\u3059\u3002\u7279\u306b\u3001\u6761\u4ef6\u3001\u30eb\u30fc\u30d7\u3001\u30ea\u30bb\u30c3\u30c8\u51e6\u7406\u304c\u6df7\u3056\u3063\u3066\u898b\u3048\u308b\u3068\u3001\u30a8\u30e9\u30fc\u304c\u8d77\u304d\u305f\u3068\u304d\u306b\u3069\u3053\u3092\u76f4\u305b\u3070\u3088\u3044\u304b\u5224\u65ad\u3057\u306b\u304f\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3088\u304f\u3042\u308b\u3064\u307e\u305a\u304d\u306f\u3001\u6b21\u306e3\u3064\u3067\u3059\u30021\u3064\u76ee\u306f\u3001`posts_per_page` \u306a\u3069\u306e\u6761\u4ef6\u3092\u5909\u3048\u3066\u3082\u671f\u5f85\u3057\u305f\u4ef6\u6570\u306b\u306a\u3089\u306a\u3044\u3053\u3068\u30022\u3064\u76ee\u306f\u3001`the_post()` \u3092\u4f7f\u3063\u305f\u3042\u3068\u306b `wp_reset_postdata()` \u3092\u5fd8\u308c\u3066\u3001\u5f8c\u7d9a\u306e\u30bf\u30a4\u30c8\u30eb\u3084\u30ea\u30f3\u30af\u304c\u610f\u56f3\u3057\u306a\u3044\u6295\u7a3f\u3092\u53c2\u7167\u3057\u3066\u3057\u307e\u3046\u3053\u3068\u30023\u3064\u76ee\u306f\u3001\u30e1\u30a4\u30f3\u30af\u30a8\u30ea\u3092\u5909\u3048\u305f\u3044\u5834\u9762\u3068\u3001\u5225\u306e\u4e00\u89a7\u3092\u8ffd\u52a0\u3057\u305f\u3044\u5834\u9762\u3092\u6df7\u540c\u3059\u308b\u3053\u3068\u3067\u3059\u3002<\/p>\n<section class=\"debug-steps wpq-steps-card\"><h2>\u307e\u305a\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\">$args\u306b\u66f8\u3044\u305f\u6761\u4ef6\u304c\u30b7\u30f3\u30d7\u30eb\u304b\u78ba\u8a8d\u3059\u308b<\/div><\/li><li><span class=\"step-number wpq-step-no\">2<\/span><div class=\"step-body wpq-step-body\">posts_per_page\u30923\u4ef6\u306a\u3069\u5c0f\u3055\u3044\u6570\u306b\u3057\u3066\u8a66\u3059<\/div><\/li><li><span class=\"step-number wpq-step-no\">3<\/span><div class=\"step-body wpq-step-body\">\u30eb\u30fc\u30d7\u5185\u3067have_posts()\u3068the_post()\u3092\u6b63\u3057\u304f\u4f7f\u3063\u3066\u3044\u308b\u304b\u898b\u308b<\/div><\/li><li><span class=\"step-number wpq-step-no\">4<\/span><div class=\"step-body wpq-step-body\">the_post()\u3092\u4f7f\u3063\u305f\u5f8c\u306bwp_reset_postdata()\u304c\u3042\u308b\u304b\u78ba\u8a8d\u3059\u308b<\/div><\/li><\/ol><\/section>\n<p>\u3044\u304d\u306a\u308a\u8907\u96d1\u306a\u6761\u4ef6\u3092\u8db3\u3059\u3068\u3001\u3069\u3053\u3067\u9593\u9055\u3063\u3066\u3044\u308b\u306e\u304b\u5206\u304b\u308a\u306b\u304f\u304f\u306a\u308a\u307e\u3059\u3002\u6700\u65b0\u8a18\u4e8b3\u4ef6\u306e\u3088\u3046\u306a\u6700\u5c0f\u69cb\u6210\u3067\u8868\u793a\u3067\u304d\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3001\u305d\u306e\u5f8c\u3067\u30ab\u30c6\u30b4\u30ea\u30fc\u3001\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u3001\u4e26\u3073\u9806\u306a\u3069\u30921\u3064\u305a\u3064\u8db3\u3059\u3068\u3001\u539f\u56e0\u3092\u5207\u308a\u5206\u3051\u3089\u308c\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\">\u516c\u5f0f\u8cc7\u6599\u3067\u78ba\u8a8d\u3057\u305f\u3044\u30dd\u30a4\u30f3\u30c8<\/span><\/h2>\n<p>WP_Query\u306f\u4f7f\u3048\u308b\u5f15\u6570\u304c\u591a\u3044\u305f\u3081\u3001\u3059\u3079\u3066\u3092\u6697\u8a18\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u3080\u3057\u308d\u3001\u5fc5\u8981\u306a\u5834\u9762\u3067\u516c\u5f0f\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u3092\u958b\u304d\u3001\u5bfe\u8c61\u306e\u5f15\u6570\u3060\u3051\u78ba\u8a8d\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u3053\u3068\u304c\u5927\u5207\u3067\u3059\u3002<\/p>\n<p>\u7279\u306b\u521d\u5fc3\u8005\u306e\u3046\u3061\u306f\u3001WP_Query\u5168\u4f53\u3001The Loop\u3001wp_reset_postdata() \u306e3\u3064\u3092\u5206\u3051\u3066\u78ba\u8a8d\u3059\u308b\u3068\u7406\u89e3\u3057\u3084\u3059\u3044\u3067\u3059\u3002\u53d6\u5f97\u6761\u4ef6\u3067\u8ff7\u3063\u305f\u3089WP_Query\u3001\u8868\u793a\u306e\u6d41\u308c\u3067\u8ff7\u3063\u305f\u3089The Loop\u3001\u30eb\u30fc\u30d7\u5f8c\u306e\u623b\u3057\u51e6\u7406\u3067\u8ff7\u3063\u305f\u3089wp_reset_postdata()\u3092\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\">WP_Query\u306e\u6982\u8981\u3001\u4f7f\u7528\u4f8b\u3001\u5404\u7a2e\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\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\/classic-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\">WordPress\u3067\u6295\u7a3f\u3092\u9806\u756a\u306b\u8868\u793a\u3059\u308b\u57fa\u672c\u306e\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\">WP_Query\u306e\u30eb\u30fc\u30d7\u5f8c\u306b\u6295\u7a3f\u30c7\u30fc\u30bf\u3092\u623b\u3059\u7406\u7531\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=\"summary\" 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\">WP_Query\u306f\u5c0f\u3055\u304f\u8a66\u3059\u3068\u7406\u89e3\u3057\u3084\u3059\u3044<\/span><\/h2>\n<p>WP_Query\u306f\u96e3\u3057\u305d\u3046\u306b\u898b\u3048\u307e\u3059\u304c\u3001\u6700\u521d\u306b\u7406\u89e3\u3059\u308b\u3053\u3068\u306f\u591a\u304f\u3042\u308a\u307e\u305b\u3093\u3002\u307e\u305a\u306f\u300c\u6761\u4ef6\u3092\u4f5c\u308b\u300d\u300c\u53d6\u5f97\u3059\u308b\u300d\u300c\u30eb\u30fc\u30d7\u3067\u8868\u793a\u3059\u308b\u300d\u300c\u6700\u5f8c\u306b\u6295\u7a3f\u30c7\u30fc\u30bf\u3092\u623b\u3059\u300d\u3068\u3044\u3046\u6d41\u308c\u3092\u62bc\u3055\u3048\u308c\u3070\u3001\u57fa\u672c\u7684\u306a\u8aad\u307f\u65b9\u306f\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u6700\u521d\u304b\u3089\u8907\u96d1\u306a\u6761\u4ef6\u3092\u7d44\u3080\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u6700\u65b0\u8a18\u4e8b\u30923\u4ef6\u3060\u3051\u8868\u793a\u3059\u308b\u3088\u3046\u306a\u5c0f\u3055\u306a\u4f8b\u304b\u3089\u59cb\u3081\u3001\u305d\u3053\u306b `post_type`\u3001\u30ab\u30c6\u30b4\u30ea\u30fc\u6761\u4ef6\u3001\u4e26\u3073\u9806\u306a\u3069\u3092\u5c11\u3057\u305a\u3064\u8db3\u3057\u3066\u3044\u304f\u3068\u3001\u3069\u306e\u5f15\u6570\u304c\u4f55\u3092\u5909\u3048\u3066\u3044\u308b\u306e\u304b\u3092\u78ba\u8a8d\u3057\u306a\u304c\u3089\u5b66\u3079\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>\u6700\u5f8c\u306b\u78ba\u8a8d\u3057\u305f\u3044\u3053\u3068<\/h2><\/div><ul class=\"wpq-checklist\"><li>WP_Query\u306f\u8868\u793a\u3059\u308b\u6295\u7a3f\u3092\u9078\u3076\u4ed5\u7d44\u307f\u3060\u3068\u8aac\u660e\u3067\u304d\u308b<\/li><li>$args\u304c\u53d6\u5f97\u6761\u4ef6\u3092\u307e\u3068\u3081\u308b\u5834\u6240\u3060\u3068\u5206\u304b\u308b<\/li><li>have_posts()\u3068the_post()\u304c\u30eb\u30fc\u30d7\u3067\u4f7f\u308f\u308c\u308b\u3053\u3068\u3092\u7406\u89e3\u3057\u3066\u3044\u308b<\/li><li>the_post()\u3092\u4f7f\u3063\u305f\u5f8c\u306fwp_reset_postdata()\u3092\u5165\u308c\u308b\u610f\u8b58\u304c\u3042\u308b<\/li><li>\u8907\u96d1\u306a\u6761\u4ef6\u3092\u8db3\u3059\u524d\u306b\u3001\u5c11\u306a\u3044\u4ef6\u6570\u306e\u6700\u5c0f\u4f8b\u3067\u78ba\u8a8d\u3067\u304d\u308b<\/li><\/ul><\/section>\n","protected":false},"excerpt":{"rendered":"<p>WP_Query\u306e\u5f79\u5272\u3001\u901a\u5e38\u306e\u30eb\u30fc\u30d7\u3068\u306e\u9055\u3044\u3001\u6700\u5c0f\u30b3\u30fc\u30c9\u3001\u3088\u304f\u3042\u308b\u3064\u307e\u305a\u304d\u3092\u521d\u5fc3\u8005\u5411\u3051\u306b\u6574\u7406\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"author":2,"featured_media":3801,"template":"","meta":{"wpq_kicker":"WP_Query\u57fa\u790e","wpq_lead":"WP_Query\u306f\u3001WordPress\u3067\u300c\u3069\u306e\u8a18\u4e8b\u3092\u3001\u3069\u306e\u6761\u4ef6\u3067\u3001\u3069\u306e\u9806\u756a\u3067\u53d6\u308a\u51fa\u3059\u304b\u300d\u3092\u6307\u5b9a\u3059\u308b\u305f\u3081\u306e\u4ed5\u7d44\u307f\u3067\u3059\u3002WP_Query\u306e\u5f79\u5272\u3092\u901a\u5e38\u306e\u30eb\u30fc\u30d7\u3068\u306e\u9055\u3044\u304b\u3089\u6574\u7406\u3057\u3001\u6700\u5c0f\u30b3\u30fc\u30c9\u3068\u8aad\u307f\u3069\u3053\u308d\u307e\u3067\u521d\u5fc3\u8005\u5411\u3051\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002","wpq_hero_title_line1":"","wpq_hero_title_line2":"","wpq_hero_title_accent":"","wpq_hero_thumbnail_alt":"WP_Query\u3068\u306f\uff1f\u521d\u5fc3\u8005\u5411\u3051\u306b\u5f79\u5272\u3068\u4f7f\u3044\u65b9\u3092\u89e3\u8aac \u306e\u30d2\u30fc\u30ed\u30fc\u30b5\u30e0\u30cd\u30a4\u30eb","wpq_hero_summary_mode":"","wpq_hero_summary_label":"\u5f79\u5272\u3092\u5148\u306b\u78ba\u8a8d","wpq_hero_summary_items":"`WP_Query`::\u8868\u793a\u3059\u308b\u6295\u7a3f\u3092\u9078\u3076\n`\u30eb\u30fc\u30d7`::\u9078\u3093\u3060\u6295\u7a3f\u3092\u51fa\u3059","wpq_reading_time":"","wpq_difficulty_label":"","wpq_difficulty_stars":"1","wpq_target_audience":"WP_Query\u3068\u3044\u3046\u8a00\u8449\u3092\u898b\u304b\u3051\u305f\u304c\u3001\u4f55\u306e\u305f\u3081\u306b\u4f7f\u3046\u3082\u306e\u304b\u307e\u3060\u6574\u7406\u3067\u304d\u3066\u3044\u306a\u3044WordPress\u521d\u5fc3\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\/\nThe Loop|https:\/\/developer.wordpress.org\/themes\/classic-themes\/basics\/the-loop\/\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":[17],"tags":[21,23,24],"wpq_card_label":[2,3],"wpq_difficulty":[10],"class_list":["post-281","wpq_article","type-wpq_article","status-publish","has-post-thumbnail","hentry","category-basic","tag-pre_get_posts","tag-the-loop","tag-wp_reset_postdata"],"_links":{"self":[{"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_article\/281","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":1,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_article\/281\/revisions"}],"predecessor-version":[{"id":4487,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_article\/281\/revisions\/4487"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/media\/3801"}],"wp:attachment":[{"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/media?parent=281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/categories?post=281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/tags?post=281"},{"taxonomy":"wpq_card_label","embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_card_label?post=281"},{"taxonomy":"wpq_difficulty","embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_difficulty?post=281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}