{"id":280,"date":"2026-08-20T13:14:19","date_gmt":"2026-08-20T04:14:19","guid":{"rendered":"https:\/\/wptoolslab.com\/query-lab\/?post_type=wpq_article&amp;p=280"},"modified":"2026-08-20T13:14:19","modified_gmt":"2026-08-20T04:14:19","slug":"wp-query-basic-syntax","status":"publish","type":"wpq_article","link":"https:\/\/wptoolslab.com\/query-lab\/articles\/wp-query-basic-syntax\/","title":{"rendered":"WP_Query\u306e\u57fa\u672c\u69cb\u6587\u3068$args\u306e\u66f8\u304d\u65b9"},"content":{"rendered":"<section class=\"conclusion wpq-conclusion\"><h2 class=\"wpq-conclusion__title\">\u57fa\u672c\u5f62\u306f\u3053\u306e\u9806\u756a<\/h2><p>WP_Query\u306e\u57fa\u672c\u69cb\u6587\u306f\u3001\u300c\u6761\u4ef6\u300d\u300c\u53d6\u5f97\u300d\u300c\u30eb\u30fc\u30d7\u300d\u300c\u30ea\u30bb\u30c3\u30c8\u300d\u306e4\u3064\u306b\u5206\u3051\u308b\u3068\u8aad\u3081\u307e\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001\u901a\u5e38\u6295\u7a3f\u3092\u65b0\u3057\u3044\u9806\u306b3\u4ef6\u53d6\u5f97\u3057\u3001\u30bf\u30a4\u30c8\u30eb\u30ea\u30f3\u30af\u3092\u4e00\u89a7\u8868\u793a\u3059\u308b\u30b3\u30fc\u30c9\u3092\u4f7f\u3063\u3066\u3001`$args`\u304b\u3089`wp_reset_postdata()`\u307e\u3067\u3092\u9806\u306b\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<\/section>\n<h2 id=\"what-we-build\" 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\">\u3053\u306e\u8a18\u4e8b\u3067\u4f5c\u308b\u3082\u306e\u30684\u3064\u306e\u57fa\u672c\u90e8\u5206<\/span><\/h2>\n<p>\u4f5c\u308b\u306e\u306f\u3001\u6700\u65b0\u306e\u901a\u5e38\u6295\u7a3f\u3092\u53d6\u5f97\u3057\u3066\u3001\u30bf\u30a4\u30c8\u30eb\u3068\u30ea\u30f3\u30af\u3092\u8868\u793a\u3059\u308b\u5c0f\u3055\u306a\u4e00\u89a7\u3067\u3059\u3002\u307e\u305a\u53d6\u5f97\u6761\u4ef6\u3092\u5c11\u306a\u304f\u3057\u305f\u30b3\u30fc\u30c9\u3067\u52d5\u4f5c\u3092\u78ba\u8a8d\u3057\u3001\u305d\u306e\u5f8c\u306b\u4ef6\u6570\u3068\u4e26\u3073\u9806\u3092\u8db3\u3057\u307e\u3059\u3002<\/p>\n<span class=\"wpq-marker wpq-marker--yellow\">\u3053\u306e\u4e00\u89a7\u3092\u7d44\u307f\u7acb\u3066\u306a\u304c\u3089\u3001WP_Query\u306e\u57fa\u672c\u69cb\u6587\u3068\u3001`$args`\u3078\u300c\u4f55\u3092\u30fb\u4f55\u4ef6\u30fb\u3069\u306e\u9806\u756a\u3067\u53d6\u5f97\u3059\u308b\u304b\u300d\u3092\u66f8\u304f\u65b9\u6cd5\u3092\u5b66\u3073\u307e\u3059\u3002<\/span>\n<p>\u57fa\u672c\u69cb\u6587\u3092\u6700\u521d\u304b\u3089\u4e38\u6697\u8a18\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u305d\u308c\u305e\u308c\u306e\u307e\u3068\u307e\u308a\u304c\u4f55\u3092\u3057\u3066\u3044\u308b\u304b\u3092\u65e5\u672c\u8a9e\u3067\u8a00\u3048\u308b\u3088\u3046\u306b\u3059\u308b\u3068\u3001\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u8aad\u307f\u66ff\u3048\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u3082\u305d\u3082WP_Query\u304c\u4f55\u3092\u3059\u308b\u4ed5\u7d44\u307f\u306a\u306e\u304b\u66d6\u6627\u306a\u5834\u5408\u306f\u3001\u5148\u306b[WP_Query\u306e\u5f79\u5272\u3068\u4f7f\u3044\u3069\u3053\u308d](..\/wp-query-basics\/)\u3092\u78ba\u8a8d\u3057\u3066\u304b\u3089\u623b\u308b\u3068\u3001\u3053\u3053\u3067\u6271\u30464\u3064\u306e\u307e\u3068\u307e\u308a\u3092\u8ffd\u3044\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u7279\u306b `$args` \u306f\u3001WP_Query\u3092\u5b66\u3073\u59cb\u3081\u305f\u4eba\u304c\u6700\u521d\u306b\u3064\u307e\u305a\u304d\u3084\u3059\u3044\u5834\u6240\u3067\u3059\u3002`$args` \u306f\u7279\u5225\u306a\u9b54\u6cd5\u306e\u540d\u524d\u3067\u306f\u306a\u304f\u3001\u53d6\u5f97\u6761\u4ef6\u3092\u307e\u3068\u3081\u305f\u914d\u5217\u3067\u3059\u3002\u540d\u524d\u306f\u5909\u3048\u3089\u308c\u307e\u3059\u304c\u3001WordPress\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u306f `$args` \u3068\u3044\u3046\u540d\u524d\u304c\u3088\u304f\u4f7f\u308f\u308c\u308b\u305f\u3081\u3001\u6700\u521d\u306f\u305d\u306e\u307e\u307e\u899a\u3048\u308b\u3068\u8aad\u307f\u3084\u3059\u3044\u3067\u3059\u3002<\/p>\n<div class=\"wpq-table-block\"><p class=\"wpq-table-hint\" aria-hidden=\"true\">\u8868\u306f\u6a2a\u306b\u30b9\u30af\u30ed\u30fc\u30eb\u3067\u304d\u307e\u3059<\/p><div class=\"cause-table table-scroll wpq-table-wrap\" role=\"region\" tabindex=\"0\" aria-label=\"\u8868: \u307e\u3068\u307e\u308a \/ \u5f79\u5272 \/ \u521d\u5fc3\u8005\u5411\u3051\u306e\u898b\u65b9\"><table class=\"article-table table-priority wpq-article-table\"><thead><tr><th>\u307e\u3068\u307e\u308a<\/th><th>\u5f79\u5272<\/th><th>\u521d\u5fc3\u8005\u5411\u3051\u306e\u898b\u65b9<\/th><\/tr><\/thead><tbody><tr><td>$args<\/td><td>\u53d6\u5f97\u6761\u4ef6\u3092\u307e\u3068\u3081\u308b<\/td><td>\u4f55\u3092\u3001\u4f55\u4ef6\u3001\u3069\u3046\u4e26\u3079\u308b\u304b\u3092\u66f8\u304f\u5834\u6240<\/td><\/tr><tr><td>new WP_Query( $args )<\/td><td>\u6761\u4ef6\u306b\u5408\u3046\u6295\u7a3f\u3092\u53d6\u5f97\u3059\u308b<\/td><td>\u6ce8\u6587\u66f8\u3092WordPress\u306b\u6e21\u3059\u90e8\u5206<\/td><\/tr><tr><td>have_posts() \/ the_post()<\/td><td>\u6295\u7a3f\u306e\u6709\u7121\u3092\u78ba\u8a8d\u3057\u30661\u4ef6\u305a\u3064\u6e96\u5099\u3059\u308b<\/td><td>\u53d6\u5f97\u7d50\u679c\u3092\u9806\u756a\u306b\u8868\u793a\u3059\u308b\u30eb\u30fc\u30d7<\/td><\/tr><tr><td>wp_reset_postdata()<\/td><td>\u30e1\u30a4\u30f3\u30af\u30a8\u30ea\u306e\u6295\u7a3f\u30c7\u30fc\u30bf\u3078\u623b\u3059<\/td><td>\u5f8c\u7d9a\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30bf\u30b0\u304c\u5225\u6295\u7a3f\u3092\u53c2\u7167\u3059\u308b\u306e\u3092\u9632\u3050\u5f8c\u7247\u4ed8\u3051<\/td><\/tr><\/tbody><\/table><\/div><\/div>\n<p>\u3053\u306e\u8868\u306e\u4e2d\u3067\u3001\u6700\u521d\u306b\u610f\u8b58\u3057\u305f\u3044\u306e\u306f `$args` \u3068\u30eb\u30fc\u30d7\u306e\u5883\u76ee\u3067\u3059\u3002`$args` \u306f\u300c\u3069\u306e\u6295\u7a3f\u3092\u53d6\u308b\u304b\u300d\u3092\u6c7a\u3081\u308b\u90e8\u5206\u3067\u3001\u30eb\u30fc\u30d7\u306f\u300c\u53d6\u3063\u3066\u304d\u305f\u6295\u7a3f\u3092\u3069\u3046\u8868\u793a\u3059\u308b\u304b\u300d\u3092\u6c7a\u3081\u308b\u90e8\u5206\u3067\u3059\u3002\u3053\u3053\u3092\u6df7\u540c\u3059\u308b\u3068\u3001\u8868\u793a\u4ef6\u6570\u3092\u5909\u3048\u305f\u3044\u306e\u306b\u30eb\u30fc\u30d7\u5074\u3092\u76f4\u305d\u3046\u3068\u3057\u305f\u308a\u3001\u898b\u305f\u76ee\u3092\u5909\u3048\u305f\u3044\u306e\u306b `$args` \u3092\u89e6\u3063\u3066\u3057\u307e\u3063\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n<h2 id=\"where-to-place\" class=\"h-underline section-heading\"><span class=\"section-heading-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><span class=\"section-heading-text\">\u30b3\u30fc\u30c9\u306f\u3069\u3053\u306b\u66f8\u304f\u306e\u304b<\/span><\/h2>\n<p>\u5b8c\u6210\u4f8b\u306f\u3001\u30af\u30e9\u30b7\u30c3\u30af\u30c6\u30fc\u30de\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u307e\u305f\u306f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30d1\u30fc\u30c4\u3067\u3001\u4e00\u89a7\u3092\u8868\u793a\u3057\u305f\u3044\u4f4d\u7f6e\u306b\u7f6e\u304d\u307e\u3059\u3002\u6295\u7a3f\u672c\u6587\u3084`functions.php`\u306e\u76f4\u4e0b\u3078\u8cbc\u308b\u30b3\u30fc\u30c9\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002`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<p>\u4f8b\u3067\u306f\u901a\u5e38\u6295\u7a3f\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081`post_type`\u3092`post`\u306b\u3057\u3066\u3044\u307e\u3059\u3002\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u3067\u4f7f\u3046\u5834\u5408\u306f\u3001\u5b9f\u969b\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u308b\u6295\u7a3f\u30bf\u30a4\u30d7\u30b9\u30e9\u30c3\u30b0\u3078\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u8a2d\u7f6e\u5834\u6240\u3054\u3068\u306e\u9055\u3044\u306f\u3001\u5c02\u7528\u8a18\u4e8b\u304c\u516c\u958b\u3055\u308c\u305f\u5f8c\u306b\u6b21\u306e\u6848\u5185\u304b\u3089\u78ba\u8a8d\u3067\u304d\u307e\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\/?post_type=wpq_article&#038;p=4077\"><span class=\"article-thumb wpq-related-link__thumb\"><img decoding=\"async\" alt=\"WP_Query\u30b3\u30fc\u30c9\u306f\u3069\u3053\u306b\u66f8\u304f\uff1f\u8a2d\u7f6e\u5834\u6240\u3068\u4f7f\u3044\u5206\u3051\" 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>WP_Query\u30b3\u30fc\u30c9\u306f\u3069\u3053\u306b\u66f8\u304f\uff1f\u8a2d\u7f6e\u5834\u6240\u3068\u4f7f\u3044\u5206\u3051<\/b><span class=\"jump\"><span>\u8a18\u4e8b\u3092\u8aad\u3080<\/span><\/span><\/div><\/a><\/div>\n<h2 id=\"args-writing\" 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\u306e\u66f8\u304d\u65b9\u306f\u300c\u5bfe\u8c61\u30fb\u4ef6\u6570\u30fb\u9806\u756a\u300d\u306b\u5206\u3051\u308b<\/span><\/h2>\n<p>`$args` \u306b\u66f8\u3051\u308b\u6761\u4ef6\u306f\u3068\u3066\u3082\u591a\u3044\u3067\u3059\u304c\u3001\u6700\u521d\u304b\u3089\u5168\u90e8\u3092\u899a\u3048\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u521d\u5fc3\u8005\u304c\u307e\u305a\u4f7f\u3046\u3053\u3068\u304c\u591a\u3044\u306e\u306f\u3001\u53d6\u5f97\u5bfe\u8c61\u3001\u53d6\u5f97\u4ef6\u6570\u3001\u4e26\u3073\u9806\u306e3\u3064\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e3\u3064\u306b\u5206\u3051\u3066\u8003\u3048\u308b\u3068\u3001\u5b9f\u88c5\u6642\u306e\u8ff7\u3044\u304c\u304b\u306a\u308a\u6e1b\u308a\u307e\u3059\u3002\u305f\u3068\u3048\u3070\u300c\u30a4\u30d9\u30f3\u30c8\u306e\u4e00\u89a7\u30925\u4ef6\u51fa\u3057\u305f\u3044\u300d\u306a\u3089\u3001\u5bfe\u8c61\u306f\u30a4\u30d9\u30f3\u30c8\u306e\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u3001\u4ef6\u6570\u306f5\u4ef6\u3001\u9806\u756a\u306f\u65e5\u4ed8\u9806\u3001\u3068\u3044\u3046\u3088\u3046\u306b\u65e5\u672c\u8a9e\u3067\u6574\u7406\u3057\u3066\u304b\u3089 `$args` \u306b\u843d\u3068\u3057\u8fbc\u3081\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\u9806\u756a \/ \u4ee3\u8868\u7684\u306a\u5f15\u6570 \/ \u4f8b\"><table class=\"article-table table-priority wpq-article-table\"><thead><tr><th>\u8003\u3048\u308b\u9806\u756a<\/th><th>\u4ee3\u8868\u7684\u306a\u5f15\u6570<\/th><th>\u4f8b<\/th><\/tr><\/thead><tbody><tr><td>\u4f55\u3092\u53d6\u5f97\u3059\u308b\u304b<\/td><td>post_type<\/td><td>&#039;post&#039;\u3001&#039;page&#039;\u3001&#039;event&#039; \u306a\u3069<\/td><\/tr><tr><td>\u4f55\u4ef6\u53d6\u5f97\u3059\u308b\u304b<\/td><td>posts_per_page<\/td><td>1\u30013\u300110 \u306a\u3069<\/td><\/tr><tr><td>\u3069\u3046\u4e26\u3079\u308b\u304b<\/td><td>orderby \/ order<\/td><td>\u65e5\u4ed8\u9806\u3001\u6607\u9806\u3001\u964d\u9806\u306a\u3069<\/td><\/tr><tr><td>\u516c\u958b\u6e08\u307f\u306b\u9650\u5b9a\u3059\u308b\u304b<\/td><td>post_status<\/td><td>&#039;publish&#039; \u306a\u3069<\/td><\/tr><\/tbody><\/table><\/div><\/div>\n<p>`event` \u306f\u8aac\u660e\u7528\u306e\u4f8b\u3067\u3059\u3002\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u3067\u4f7f\u3046\u3068\u304d\u306f\u3001\u5b9f\u969b\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u308b\u6295\u7a3f\u30bf\u30a4\u30d7\u30b9\u30e9\u30c3\u30b0\u3078\u7f6e\u304d\u63db\u3048\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u6b21\u306b\u5b66\u3076\u306a\u3089\u3001[post_type\u306e\u6307\u5b9a\u65b9\u6cd5](..\/post-type-parameter\/)\u3067\u53d6\u5f97\u5bfe\u8c61\u3092\u5909\u3048\u3089\u308c\u308b\u3088\u3046\u306b\u3059\u308b\u306e\u304c\u304a\u3059\u3059\u3081\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-orderby-order\/\"><span class=\"article-thumb wpq-related-link__thumb\"><img decoding=\"async\" alt=\"WP_Query\u306eorderby\u3068order\u306e\u9055\u3044\" src=\"https:\/\/wptoolslab.com\/query-lab\/wp-content\/uploads\/2026\/08\/wp-query-orderby-order-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\u306eorderby\u3068order\u306e\u9055\u3044<\/b><span class=\"jump\"><span>\u8a18\u4e8b\u3092\u8aad\u3080<\/span><\/span><\/div><\/a><\/div>\n<h2 id=\"complete-example\" 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\">\u57fa\u672c\u69cb\u6587\u30921\u3064\u306e\u30b3\u30fc\u30c9\u3067\u78ba\u8a8d\u3059\u308b<\/span><\/h2>\n<p>\u6b21\u306e\u4f8b\u306f\u3001\u901a\u5e38\u6295\u7a3f\u3092\u65b0\u3057\u3044\u9806\u306b3\u4ef6\u53d6\u5f97\u3057\u3001\u30bf\u30a4\u30c8\u30eb\u30ea\u30f3\u30af\u3092\u30ea\u30b9\u30c8\u8868\u793a\u3057\u307e\u3059\u3002\u6700\u521d\u306f\u3053\u306e\u307e\u307e\u691c\u8a3c\u74b0\u5883\u3067\u52d5\u304b\u3057\u3001\u8868\u793a\u3067\u304d\u3066\u304b\u3089\u5024\u3092\u5909\u3048\u3066\u304f\u3060\u3055\u3044\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-post-list.php<\/span><span class=\"code-purpose wpq-code-pill\">\u5b9f\u7528\u306e\u5b8c\u6210\u4f8b\uff1a\u6700\u65b0\u6295\u7a3f3\u4ef6\u3092ul\u8981\u7d20\u306e\u4e00\u89a7\u3067\u8868\u793a<\/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: \u5b9f\u7528\u306e\u5b8c\u6210\u4f8b\uff1a\u6700\u65b0\u6295\u7a3f3\u4ef6\u3092ul\u8981\u7d20\u306e\u4e00\u89a7\u3067\u8868\u793a \/ latest-post-list.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\">   <span class=\"c-key\">&#039;orderby&#039;<\/span>        =&gt; <span class=\"c-str\">&#039;date&#039;<\/span>,&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">   <span class=\"c-key\">&#039;order&#039;<\/span>          =&gt; <span class=\"c-str\">&#039;DESC&#039;<\/span>,&lt;br \/&gt;<\/span><span class=\"wpq-code-line\">];&lt;\/p&gt;<\/span><span class=\"wpq-code-line\">&lt;p&gt;<span class=\"c-var\">$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   &#039;orderby&#039;        =&gt; &#039;date&#039;,&lt;br \/&gt;\n   &#039;order&#039;          =&gt; &#039;DESC&#039;,&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>\u30b3\u30fc\u30c9\u5168\u4f53\u3092\u4e00\u5ea6\u306b\u8aad\u307e\u305a\u3001\u6b21\u306e3\u304b\u6240\u306b\u5206\u3051\u3066\u898b\u307e\u3059\u3002<\/p>\n<h3 id=\"query-arguments\" class=\"wpq-subheading\">$args\u3068new WP_Query()<\/h3>\n<p>`$args`\u306b\u306f\u3001\u901a\u5e38\u6295\u7a3f\u30923\u4ef6\u3001\u65b0\u3057\u3044\u9806\u306b\u53d6\u5f97\u3059\u308b\u6761\u4ef6\u304c\u3042\u308a\u307e\u3059\u3002`new WP_Query( $args )`\u306f\u305d\u306e\u6761\u4ef6\u3067\u6295\u7a3f\u3092\u53d6\u5f97\u3057\u3001\u7d50\u679c\u3092`$latest_posts`\u3078\u5165\u308c\u307e\u3059\u3002\u5909\u6570\u540d\u306f\u4efb\u610f\u3067\u3059\u304c\u3001\u53d6\u5f97\u5185\u5bb9\u304c\u5206\u304b\u308b\u540d\u524d\u306b\u3059\u308b\u3068\u5f8c\u306e\u30eb\u30fc\u30d7\u3092\u8ffd\u3044\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3 id=\"query-loop\" class=\"wpq-subheading\">have_posts()\u3068the_post()<\/h3>\n<p>`$latest_posts-&gt;have_posts()`\u3067\u6b21\u306e\u6295\u7a3f\u304c\u3042\u308b\u304b\u3092\u78ba\u8a8d\u3057\u3001`$latest_posts-&gt;the_post()`\u30671\u4ef6\u5206\u306e\u6295\u7a3f\u30c7\u30fc\u30bf\u3092\u6e96\u5099\u3057\u307e\u3059\u3002\u30bf\u30a4\u30c8\u30eb\u30ea\u30f3\u30af\u306f`while`\u306e\u4e2d\u306b\u3042\u308b\u305f\u3081\u3001\u53d6\u5f97\u3057\u305f\u6295\u7a3f\u3054\u3068\u306b1\u884c\u305a\u3064\u51fa\u529b\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u8868\u793a\u4ef6\u6570\u3092\u5909\u3048\u308b\u306a\u3089`$args`\u306e`posts_per_page`\u3001\u65e5\u4ed8\u3084\u629c\u7c8b\u3092\u8ffd\u52a0\u3059\u308b\u306a\u3089\u30eb\u30fc\u30d7\u5185\u3092\u5909\u66f4\u3057\u307e\u3059\u3002\u53d6\u5f97\u6761\u4ef6\u3068\u8868\u793a\u5185\u5bb9\u3092\u5206\u3051\u308c\u3070\u3001\u3069\u3053\u3092\u76f4\u3059\u3079\u304d\u304b\u8ff7\u3044\u306b\u304f\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3 id=\"reset-postdata\" class=\"wpq-subheading\">wp_reset_postdata()\u3092\u6700\u5f8c\u306b\u66f8\u304f\u7406\u7531<\/h3>\n<p>\u72ec\u81eaWP_Query\u3067 `the_post()` \u3092\u547c\u3076\u3068\u3001\u30b0\u30ed\u30fc\u30d0\u30eb\u306a\u73fe\u5728\u306e\u6295\u7a3f\u30c7\u30fc\u30bf\u304c\u72ec\u81ea\u30af\u30a8\u30ea\u5074\u3078\u5207\u308a\u66ff\u308f\u308a\u307e\u3059\u3002\u305d\u306e\u307e\u307e\u306b\u3059\u308b\u3068\u3001\u30eb\u30fc\u30d7\u5f8c\u306e `the_title()` \u3084 `the_content()` \u304c\u5225\u6295\u7a3f\u3092\u53c2\u7167\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u72ec\u81ea\u30eb\u30fc\u30d7\u306e\u672b\u5c3e\u306b `wp_reset_postdata()` \u3092\u7f6e\u304d\u3001\u30e1\u30a4\u30f3\u30af\u30a8\u30ea\u306e\u6295\u7a3f\u30c7\u30fc\u30bf\u3078\u623b\u3057\u307e\u3059\u3002\u6700\u5c0f\u4f8b\u306e\u3088\u3046\u306b\u8a72\u5f53\u6295\u7a3f\u304c\u306a\u3044\u5834\u5408\u306f `the_post()` \u304c\u547c\u3070\u308c\u306a\u3044\u305f\u3081\u3001\u6295\u7a3f\u30c7\u30fc\u30bf\u3082\u5207\u308a\u66ff\u308f\u308a\u307e\u305b\u3093\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-reset-postdata-reason\/\"><span class=\"article-thumb wpq-related-link__thumb\"><img decoding=\"async\" alt=\"wp_reset_postdata()\u304c\u5fc5\u8981\u306a\u7406\u7531\" 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>\u3042\u308f\u305b\u3066\u8aad\u307f\u305f\u3044<\/small><b>wp_reset_postdata()\u304c\u5fc5\u8981\u306a\u7406\u7531<\/b><span class=\"jump\"><span>\u8a18\u4e8b\u3092\u8aad\u3080<\/span><\/span><\/div><\/a><\/div>\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\">\u57fa\u672c\u69cb\u6587\u3067\u3088\u304f\u3042\u308b\u3064\u307e\u305a\u304d<\/span><\/h2>\n<p>WP_Query\u306e\u57fa\u672c\u69cb\u6587\u3067\u8d77\u304d\u308b\u30df\u30b9\u306f\u3001\u8907\u96d1\u306a\u6761\u4ef6\u3088\u308a\u3082\u3001\u57fa\u672c\u306e\u6d41\u308c\u304c\u5c11\u3057\u5d29\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u539f\u56e0\u306b\u306a\u308a\u3084\u3059\u3044\u3067\u3059\u3002\u7279\u306b\u3001`$args` \u306e\u66f8\u304d\u65b9\u3001\u5909\u6570\u540d\u306e\u4e0d\u4e00\u81f4\u3001\u30ea\u30bb\u30c3\u30c8\u5fd8\u308c\u306f\u3088\u304f\u78ba\u8a8d\u3057\u305f\u3044\u30dd\u30a4\u30f3\u30c8\u3067\u3059\u3002<\/p>\n<p>\u30a8\u30e9\u30fc\u304c\u51fa\u305f\u3068\u304d\u306b\u3059\u3050\u5168\u4f53\u3092\u66f8\u304d\u76f4\u3059\u306e\u3067\u306f\u306a\u304f\u3001\u307e\u305a\u306f\u6700\u5c0f\u4f8b\u306b\u623b\u3059\u306e\u304c\u304a\u3059\u3059\u3081\u3067\u3059\u30021\u4ef6\u3060\u3051\u53d6\u5f97\u3059\u308b\u30b3\u30fc\u30c9\u306b\u623b\u3057\u3066\u52d5\u304f\u304b\u78ba\u8a8d\u3057\u3001\u305d\u306e\u5f8c\u3067\u6761\u4ef6\u30921\u3064\u305a\u3064\u8db3\u3057\u3066\u3044\u304f\u3068\u3001\u3069\u306e\u6761\u4ef6\u3067\u5d29\u308c\u305f\u304b\u3092\u898b\u3064\u3051\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u78ba\u8a8d\u3059\u308b\u5834\u6240\u306f4\u3064\u3067\u3059\u3002<\/p>\n<p>&#8211; \u6700\u521d\u306f`post_type`\u3068`posts_per_page`\u3060\u3051\u3067\u8a66\u3059<br \/>\n&#8211; `new WP_Query()`\u3001`have_posts()`\u3001`the_post()`\u3067\u540c\u3058\u5909\u6570\u540d\u3092\u4f7f\u3046<br \/>\n&#8211; `the_post()`\u3092\u4f7f\u3063\u305f\u72ec\u81ea\u30eb\u30fc\u30d7\u306e\u5f8c\u306b`wp_reset_postdata()`\u3092\u66f8\u304f<br \/>\n&#8211; \u53d6\u5f97\u6761\u4ef6\u3068\u8868\u793a\u5185\u5bb9\u3092\u540c\u6642\u306b\u5909\u66f4\u3057\u306a\u3044<\/p>\n<p>\u307e\u305f\u3001`$args` \u306e\u914d\u5217\u3067\u306f\u30ab\u30f3\u30de\u306e\u629c\u3051\u306b\u3082\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002PHP\u306e\u914d\u5217\u3067\u306f\u3001\u5404\u884c\u306e\u533a\u5207\u308a\u3068\u3057\u3066\u30ab\u30f3\u30de\u3092\u4f7f\u3044\u307e\u3059\u3002\u30b3\u30fc\u30c9\u3092\u8cbc\u308a\u4ed8\u3051\u305f\u3042\u3068\u306b\u767d\u3044\u753b\u9762\u3084\u69cb\u6587\u30a8\u30e9\u30fc\u306b\u306a\u308b\u5834\u5408\u306f\u3001\u6761\u4ef6\u540d\u306e\u30b9\u30da\u30eb\u3001\u30af\u30a9\u30fc\u30c8\u3001\u30ab\u30f3\u30de\u3092\u843d\u3061\u7740\u3044\u3066\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u57fa\u672c\u69cb\u6587\u304c\u52d5\u3044\u305f\u3089\u3001\u76ee\u7684\u306b\u5fc5\u8981\u306a\u6761\u4ef6\u30921\u3064\u305a\u3064\u8db3\u3057\u307e\u3059\u3002\u53d6\u5f97\u5bfe\u8c61\u306a\u3089 `post_type`\u3001\u4ef6\u6570\u306a\u3089 `posts_per_page`\u3001\u4e26\u3073\u9806\u306a\u3089 `orderby` \u3068 `order` \u306e\u3088\u3046\u306b\u3001\u5909\u66f4\u3059\u308b\u5f79\u5272\u3092\u5206\u3051\u308b\u3068\u539f\u56e0\u3092\u8ffd\u3044\u3084\u3059\u304f\u306a\u308a\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\u3059\u308b\u30dd\u30a4\u30f3\u30c8<\/span><\/h2>\n<p>WP_Query\u306e\u69cb\u6587\u3084\u5f15\u6570\u306f\u3001\u516c\u5f0f\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u3092\u57fa\u6e96\u306b\u78ba\u8a8d\u3057\u307e\u3059\u3002`$args` \u306b\u6307\u5b9a\u3067\u304d\u308b\u6761\u4ef6\u306f\u591a\u3044\u305f\u3081\u3001\u8a18\u4e8b\u3084\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3060\u3051\u3067\u899a\u3048\u308b\u306e\u3067\u306f\u306a\u304f\u3001\u5fc5\u8981\u306a\u5f15\u6570\u306e\u4ed5\u69d8\u3068\u4f7f\u7528\u4f8b\u3092\u516c\u5f0f\u8cc7\u6599\u3067\u7167\u5408\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u30eb\u30fc\u30d7\u306e\u52d5\u304d\u3067\u8ff7\u3063\u305f\u3068\u304d\u306fThe Loop\u3001`the_post()` \u306e\u3042\u3068\u306b\u623b\u3059\u7406\u7531\u3092\u78ba\u8a8d\u3057\u305f\u3044\u3068\u304d\u306f `wp_reset_postdata()` \u306e\u8cc7\u6599\u3092\u898b\u308b\u3068\u3001\u5f79\u5272\u3092\u5206\u3051\u3066\u7406\u89e3\u3067\u304d\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\u57fa\u672c\u69cb\u6587\u3001\u4f7f\u7528\u4f8b\u3001\u6307\u5b9a\u3067\u304d\u308b\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\">have_posts() \u3068 the_post() \u3092\u4f7f\u3063\u305f\u8868\u793a\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\">\u57fa\u672c\u69cb\u6587\u306f4\u3064\u306b\u5206\u3051\u3066\u899a\u3048\u308b<\/span><\/h2>\n<p>WP_Query\u306e\u57fa\u672c\u69cb\u6587\u306f\u3001\u9577\u3044\u30b3\u30fc\u30c9\u3068\u3057\u3066\u899a\u3048\u308b\u3088\u308a\u3082\u30014\u3064\u306e\u307e\u3068\u307e\u308a\u306b\u5206\u3051\u3066\u7406\u89e3\u3059\u308b\u307b\u3046\u304c\u5b9f\u88c5\u3057\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002`$args` \u306f\u53d6\u5f97\u6761\u4ef6\u3001`new WP_Query()` \u306f\u53d6\u5f97\u3001`have_posts()` \u3068 `the_post()` \u306f\u8868\u793a\u306e\u305f\u3081\u306e\u30eb\u30fc\u30d7\u3001`wp_reset_postdata()` \u306f\u5f8c\u7247\u4ed8\u3051\u3067\u3059\u3002<\/p>\n<p>\u307e\u305a\u306f\u5b8c\u6210\u4f8b\u3092\u305d\u306e\u307e\u307e\u691c\u8a3c\u74b0\u5883\u3067\u8a66\u3057\u3001\u8868\u793a\u3067\u304d\u305f\u3089\u4ef6\u6570\u3084\u6295\u7a3f\u30bf\u30a4\u30d7\u30921\u3064\u305a\u3064\u5909\u3048\u307e\u3059\u3002\u5909\u66f4\u7b87\u6240\u3092\u5206\u3051\u308c\u3070\u3001\u8868\u793a\u3055\u308c\u306a\u304f\u306a\u3063\u305f\u6642\u3082\u76f4\u524d\u306b\u8db3\u3057\u305f\u6761\u4ef6\u304b\u3089\u78ba\u8a8d\u3067\u304d\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>\u57fa\u672c\u69cb\u6587\u306e\u6700\u7d42\u5224\u65ad<\/h2><\/div><ul class=\"wpq-checklist\"><li>\u53d6\u5f97\u6761\u4ef6\u30fb\u30af\u30a8\u30ea\u751f\u6210\u30fb\u30eb\u30fc\u30d7\u30fb\u30ea\u30bb\u30c3\u30c8\u306e\u5f79\u5272\u3092\u5206\u3051\u3066\u8aad\u3081\u308b<\/li><li>\u6700\u5c0f\u4f8b\u304c\u81ea\u5206\u306e\u6295\u7a3f\u30bf\u30a4\u30d7\u30671\u4ef6\u4ee5\u4e0a\u8fd4\u308b<\/li><li>\u30eb\u30fc\u30d7\u5185\u306ehave_posts()\u3068the_post()\u304c\u540c\u3058\u5909\u6570\u3092\u4f7f\u3046<\/li><li>\u8868\u793a\u306b\u5fc5\u8981\u306a\u60c5\u5831\u3060\u3051\u3092\u5f8c\u304b\u3089\u8ffd\u52a0\u3057\u305f<\/li><li>\u30b5\u30d6\u30eb\u30fc\u30d7\u5f8c\u306e\u30bf\u30a4\u30c8\u30eb\u3084ID\u304c\u5143\u306e\u8a18\u4e8b\u3078\u623b\u308b<\/li><\/ul><\/section>\n","protected":false},"excerpt":{"rendered":"<p>WP_Query\u306e\u57fa\u672c\u69cb\u6587\u3092\u3001$args\u306e\u4f5c\u308a\u65b9\u3001\u6700\u5c0f\u30b3\u30fc\u30c9\u3001\u30eb\u30fc\u30d7\u306e\u8aad\u307f\u65b9\u3001wp_reset_postdata()\u307e\u3067\u9806\u756a\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"author":2,"featured_media":3804,"template":"","meta":{"wpq_kicker":"WP_Query\u57fa\u790e","wpq_lead":"WP_Query\u306e\u30b3\u30fc\u30c9\u306f\u3001\u6761\u4ef6\u3092\u66f8\u304f$args\u3001\u53d6\u5f97\u3059\u308bnew WP_Query\u3001\u8868\u793a\u3059\u308b\u30eb\u30fc\u30d7\u3001\u6700\u5f8c\u306b\u623b\u3059wp_reset_postdata()\u306e4\u3064\u306b\u5206\u3051\u308b\u3068\u7406\u89e3\u3057\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002\u521d\u5fc3\u8005\u304c\u81ea\u5206\u3067\u66f8\u304d\u63db\u3048\u3089\u308c\u308b\u3088\u3046\u306b\u3001\u57fa\u672c\u69cb\u6587\u3092\u5b9f\u88c5\u9806\u306b\u6574\u7406\u3057\u307e\u3059\u3002","wpq_hero_title_line1":"","wpq_hero_title_line2":"","wpq_hero_title_accent":"","wpq_hero_thumbnail_alt":"WP_Query\u306e\u57fa\u672c\u69cb\u6587\u3068$args\u306e\u66f8\u304d\u65b9 \u306e\u30d2\u30fc\u30ed\u30fc\u30b5\u30e0\u30cd\u30a4\u30eb","wpq_hero_summary_mode":"","wpq_hero_summary_label":"\u5b9f\u88c5\u9806\u3092\u5148\u306b\u78ba\u8a8d","wpq_hero_summary_items":"`$args`::\u53d6\u5f97\u6761\u4ef6\u3092\u66f8\u304f\n`\u30eb\u30fc\u30d7`::\u6295\u7a3f\u3092\u8868\u793a\u3059\u308b","wpq_reading_time":"","wpq_difficulty_label":"","wpq_difficulty_stars":"1","wpq_target_audience":"WP_Query\u306e\u57fa\u672c\u69cb\u6587\u3092\u898b\u305f\u3053\u3068\u306f\u3042\u308b\u304c\u3001$args\u3001new WP_Query\u3001have_posts()\u3001the_post() \u306e\u5f79\u5272\u3092\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":[20,23,24],"wpq_card_label":[3,4],"wpq_difficulty":[10],"class_list":["post-280","wpq_article","type-wpq_article","status-publish","has-post-thumbnail","hentry","category-basic","tag-posts_per_page","tag-the-loop","tag-wp_reset_postdata"],"_links":{"self":[{"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_article\/280","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":0,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_article\/280\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/media\/3804"}],"wp:attachment":[{"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/media?parent=280"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/categories?post=280"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/tags?post=280"},{"taxonomy":"wpq_card_label","embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_card_label?post=280"},{"taxonomy":"wpq_difficulty","embeddable":true,"href":"https:\/\/wptoolslab.com\/query-lab\/wp-json\/wp\/v2\/wpq_difficulty?post=280"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}