{"id":25569,"date":"2020-01-11T03:53:27","date_gmt":"2020-01-11T11:53:27","guid":{"rendered":"https:\/\/kinsta.com\/?p=54548"},"modified":"2023-08-25T23:10:31","modified_gmt":"2023-08-25T14:10:31","slug":"wordpress-get_posts","status":"publish","type":"post","link":"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/","title":{"rendered":"\u300cWordPress get_posts\u300d\u3053\u306e\u4fbf\u5229\u306a PHP\u95a2\u6570\u3067\u6295\u7a3f\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>WordPress\u306e <code>get_posts<\/code> \u306b\u3088\u308a\u3001 <a href=\"https:\/\/kinsta.com\/jp\/blog\/hire-wordpress-developer\/\">\u30c7\u30d9\u30ed\u30c3\u30d1\u30fc<\/a>\u306f<a href=\"https:\/\/kinsta.com\/jp\/blog\/wordpress-database\/\">WordPress\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9<\/a>\u304b\u3089\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u4e00\u90e8\u3092\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u306f\u5f37\u529b\u306a\u6a5f\u80fd\u3067\u3059\u3002\u63a2\u3057\u51fa\u3059\u6295\u7a3f\u3001\u30da\u30fc\u30b8\u3001<a href=\"https:\/\/kinsta.com\/jp\/blog\/wordpress-custom-post-types\/\">\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7<\/a>\u3092\u8a73\u7d30\u306b\u6307\u5b9a\u3057\u3001\u597d\u307f\u306e\u7d50\u679c\u3092\u53d6\u5f97\u3057\u3066\u304b\u3089\u3001\u30a2\u30a4\u30c6\u30e0\u3092\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u3001\u9806\u5e8f\u4ed8\u3051\u3067\u304d\u307e\u3059\u3002PHP \/ MySQL\u306e\u30d7\u30ed\u3055\u306a\u304c\u3089\u306e\u64cd\u4f5c\u304c\u3067\u304d\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001PHP\u306b\u8a73\u3057\u304f\u306a\u3044\u65b9\u3067\u3082\u5fc3\u914d\u3044\u308a\u307e\u305b\u3093\u3002\u898b\u305f\u308a\u307e\u305f\u306f\u8aad\u3093\u3060\u308a\u3067\u304d\u308b<a href=\"https:\/\/kinsta.com\/jp\/blog\/php-tutorials\/\" target=\"_blank\" rel=\"noopener noreferrer\">PHP\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb<\/a>\u306f\u305f\u304f\u3055\u3093\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u7c21\u5358\u306b\u52c9\u5f37\u3067\u304d\u307e\u3059\u3002<code>get_posts<\/code> \u95a2\u6570\u306f\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u914d\u5217\u3092\u4fdd\u6301\u3057\u3001\u5358\u7d14\u307e\u305f\u306f\u9ad8\u5ea6\u306a\u30af\u30a8\u30ea\u3092\u4f5c\u6210\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u3001<a href=\"https:\/\/kinsta.com\/jp\/blog\/is-php-dead\/\">PHP\u306e\u77e5\u8b58<\/a>\u304c\u5c11\u3057\u3042\u308c\u3070\u3001\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u306b\u8868\u793a\u3059\u308b\u6295\u7a3f\u306e\u30ab\u30b9\u30bf\u30e0\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>WordPress\u306e\u00a0<code>get_posts<\/code>\u00a0\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u306f\u30012\u3064\u306e\u30b9\u30c6\u30c3\u30d7\u304b\u3089\u69cb\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u307e\u305a\u3001\u30ab\u30b9\u30bf\u30e0\u30af\u30a8\u30ea\u3092\u4f5c\u6210\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u5b9f\u969b\u3001MySQL\u30af\u30a8\u30ea\u306e\u3088\u3046\u306a\u898b\u305f\u76ee\u3067\u306f\u306a\u304f\u3001<code>SELECT<\/code>\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3092\u8a18\u8ff0\u3059\u308b\u3053\u3068\u3082\u3042\u308a\u307e\u305b\u3093\u3002\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u914d\u5217\u3092\u5b9a\u7fa9\u3057\u3066\u3001\u305d\u308c\u3092<code>get_posts<\/code> \u95a2\u6570\u306b\u6e21\u3059\u3060\u3051\u3067\u3059\u3002WordPress\u304c\u305d\u306e\u914d\u5217\u3092\u5b9f\u969b\u306e\u30bb\u30ad\u30e5\u30a2\u306aMySQL\u30af\u30a8\u30ea\u306b\u5909\u63db\u3057\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u5bfe\u3057\u3066\u5b9f\u884c\u3057\u3001\u6295\u7a3f\u306e\u914d\u5217\u3092\u8fd4\u3057\u307e\u3059\u3002<\/li>\n<li>\u6b21\u306b\u3001foreach\u30b5\u30a4\u30af\u30eb\u3067<code>get_posts<\/code> \u306b\u3088\u3063\u3066\u8fd4\u3055\u308c\u308b\u7d50\u679c\u3092\u8d70\u67fb\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n<\/ul>\n<p>\u305d\u308c\u3067\u306f\u3001\u3053\u306e\u6295\u7a3f\u3067\u306f\u3001\u307e\u305a\u4e0a\u8a18\u306e\u91cd\u8981\u306a\u6982\u5ff5\u3001\u7279\u306b<code>get_posts<\/code> \u306e\u4ed5\u7d44\u307f\u3001\u30ab\u30b9\u30bf\u30e0\u30af\u30a8\u30ea\u306e\u4f5c\u6210\u65b9\u6cd5\u3001\u30d5\u30ed\u30f3\u30c8\u30b5\u30a4\u30c8\u3067\u306e\u30c7\u30fc\u30bf\u306e\u8868\u793a\u65b9\u6cd5\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u6b21\u306b\u3001\u30c6\u30b9\u30c8\u3068\u958b\u767a\u306e\u305f\u3081\u306b\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u74b0\u5883\u3067\u5b9f\u969b\u306b\u7de8\u96c6\u3001\u4f7f\u7528\u3067\u304d\u308b\u30b3\u30fc\u30c9\u306e\u30b9\u30cb\u30da\u30c3\u30c8\u3092\u7528\u3044\u3066\u5b9f\u969b\u306e\u4f8b\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u6ce8\u610f\uff1a\u901a\u5e38\u3001\u300c\u6295\u7a3f\u300d\u3001\u300c\u30da\u30fc\u30b8\u300d\u3001\u300c\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u300d\u306f\u533a\u5225\u3055\u308c\u308b\u3082\u306e\u3067\u3059\u304c\u3001\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001\u901a\u5e38\u306e\u30d6\u30ed\u30b0\u306e\u6295\u7a3f\u3060\u3051\u3067\u306a\u304f\u3001\u30da\u30fc\u30b8\u3084\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3082\u542b\u3081\u3066\u300c\u6295\u7a3f\u300d\u3068\u3044\u3046\u7528\u8a9e\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u6295\u7a3f\u30bf\u30a4\u30d7\u306f\u3059\u3079\u3066\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u300cwp_posts\u300d\u30c6\u30fc\u30d6\u30eb\u306b\u4fdd\u5b58\u3055\u308c\u307e\u3059\u3002\u6295\u7a3f\u30bf\u30a4\u30d7\u306e\u4e3b\u306a\u9055\u3044\u306f\u3001 \u300cpost_type\u300d\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u5024\u3067\u3059\u3002\u958b\u767a\u8005\u306e\u89b3\u70b9\u304b\u3089\u898b\u308b\u3068\u3001\u6295\u7a3f\u3001\u30da\u30fc\u30b8\u3001\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u306f\u3059\u3079\u3066\u300c\u6295\u7a3f\u300d\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li><a href=\"#get-posts\">WordPress get_posts \u95a2\u6570\u306e\u7d39\u4ecb<\/a><\/li>\n<li><a href=\"#parameters\">WordPress get_posts \u3067\u30af\u30a8\u30ea\u3092\u4f5c\u6210\u3059\u308b\u65b9\u6cd5<\/a><\/li>\n<li><a href=\"#display\">get_posts\u3067\u8fd4\u3055\u308c\u305f\u30c7\u30fc\u30bf\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5<\/a><\/li>\n<li><a href=\"#example\">\u5b9f\u8df5\u7de8\uff1a\u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\u3067\u30a2\u30a4\u30c6\u30e0\u306e\u30ab\u30b9\u30bf\u30e0\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5<\/a><\/li>\n<\/ul>\n<h2 id=\"get-posts\">WordPress get_posts \u95a2\u6570\u306e\u7d39\u4ecb<\/h2>\n<p>Codex\u306f\u3001<a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/get_posts\/\"><code>get_posts<\/code>\u00a0\u95a2\u6570<\/a>\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8aac\u660e\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<blockquote><p>\u6700\u65b0\u306e\u6295\u7a3f\u3001\u307e\u305f\u306f\u7279\u5b9a\u306e\u6761\u4ef6\u306b\u4e00\u81f4\u3059\u308b\u6295\u7a3f\u306e\u914d\u5217\u3092\u53d6\u5f97\u3059\u308b\u3002<\/p><\/blockquote>\n<p><code>get_posts<\/code>\u00a0\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">$args = array(\n\t'numberposts'\t=&gt; 20,\n\t'category'\t\t=&gt; 4\n);\n$my_posts = get_posts( $args );\n\nif( ! empty( $my_posts ) ){\n\t$output = '&lt;ul&gt;';\n\tforeach ( $my_posts as $p ){\n\t\t$output .= '&lt;li&gt;&lt;a href=\"' . get_permalink( $p-&gt;ID ) . '\"&gt;' \n\t\t. $p-&gt;post_title . '&lt;\/a&gt;&lt;\/li&gt;';\n\t}\n\t$output .= '&lt;ul&gt;';\n}<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u95a2\u6570\u306f\u3001\u6307\u5b9a\u3055\u308c\u305f\u30ab\u30c6\u30b4\u30ea\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f <code>post_type<\/code> \u306f <code>post<\/code> \u3067\u3059\uff09\u306e\u6700\u65b0\u306e20\u4ef6\u306e\u30d6\u30ed\u30b0\u6295\u7a3f\u3092\u53d6\u5f97\u3057\u3001<code>$post<\/code> \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u914d\u5217\u3092\u8fd4\u3057\u307e\u3059\u3002\u914d\u5217\u3092\u53cd\u5fa9\u51e6\u7406\u3057\u3066\u3001\u753b\u9762\u306b\u6295\u7a3f\u3092\u8868\u793a\u3067\u304d\u307e\u3059\u3002\u3068\u3066\u3082\u7c21\u5358\u3067\u3059\u3088\u306d\uff1f<\/p>\n<p><code>get_posts<\/code> \u306f<a href=\"https:\/\/kinsta.com\/blog\/wp-query\/\"><code>WP_Query<\/code>\u3092\u4f7f\u7528<\/a>\u3057\u3066\u6295\u7a3f\u30a2\u30a4\u30c6\u30e0\u3092\u53d6\u5f97\u3057\u3001 <code>WP_Query<\/code> \u3067\u4f7f\u7528\u53ef\u80fd\u306a\u540c\u3058\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u914d\u5217\u3092\u4fdd\u6301\u3057\u307e\u3059\uff08\u4f8b\u5916\u306f\u307b\u3068\u3093\u3069\u3042\u308a\u307e\u305b\u3093\uff09\u3002\u3057\u305f\u304c\u3063\u3066\u3001\u30ab\u30b9\u30bf\u30e0\u30af\u30a8\u30ea\u306e\u4f5c\u6210\u306b\u4f7f\u7528\u3067\u304d\u308b\u5909\u6570\u306f\u81a8\u5927\u306b\u3042\u308a\u307e\u3059\u3002\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u3001\u6b21\u306e<a href=\"https:\/\/developer.wordpress.org\/reference\/classes\/wp_query\/#parameters\">15\u306e\u30ab\u30c6\u30b4\u30ea<\/a>\u306b\u30b0\u30eb\u30fc\u30d7\u5206\u3051\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u6295\u7a3f\u8005\u30d1\u30e9\u30e1\u30fc\u30bf<\/li>\n<li>\u30ab\u30c6\u30b4\u30ea\u30d1\u30e9\u30e1\u30fc\u30bf<\/li>\n<li>\u30bf\u30b0\u30d1\u30e9\u30e1\u30fc\u30bf<\/li>\n<li>\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u30d1\u30e9\u30e1\u30fc\u30bf<\/li>\n<li>\u691c\u7d22\u30d1\u30e9\u30e1\u30fc\u30bf<\/li>\n<li>\u6295\u7a3f&#038;\u30da\u30fc\u30b8\u30d1\u30e9\u30e1\u30fc\u30bf<\/li>\n<li>\u30d1\u30b9\u30ef\u30fc\u30c9\u30d1\u30e9\u30e1\u30fc\u30bf<\/li>\n<li>\u6295\u7a3f\u30bf\u30a4\u30d7\u30d1\u30e9\u30e1\u30fc\u30bf<\/li>\n<li>\u9806\u5e8f\u3065\u3051\u30d1\u30e9\u30e1\u30fc\u30bf<\/li>\n<li>\u65e5\u4ed8\u30d1\u30e9\u30e1\u30fc\u30bf<\/li>\n<li>\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\uff08\u6295\u7a3f\u30e1\u30bf\u30c7\u30fc\u30bf\uff09\u30d1\u30e9\u30e1\u30fc\u30bf<\/li>\n<li>\u6a29\u9650\u30d1\u30e9\u30e1\u30fc\u30bf<\/li>\n<li>MIME\u30bf\u30a4\u30d7\u30d1\u30e9\u30e1\u30fc\u30bf<\/li>\n<li>\u30ad\u30e3\u30c3\u30b7\u30e5\u30d1\u30e9\u30e1\u30fc\u30bf<\/li>\n<li>\u30ea\u30bf\u30fc\u30f3\u30d5\u30a3\u30fc\u30eb\u30c9\u30d1\u30e9\u30e1\u30fc\u30bf<\/li>\n<\/ul>\n<p>\u4e0a\u8a18\u306e\u30ea\u30b9\u30c8\u3092\u3056\u3063\u3068\u898b\u3066\u307f\u308b\u3068\u3001WordPress\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u5bfe\u3057\u3066\u4f5c\u6210\u30fb\u5b9f\u884c\u3067\u304d\u308b\u3055\u307e\u3056\u307e\u306a\u30ab\u30b9\u30bf\u30e0\u30af\u30a8\u30ea\u304c\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002\u305d\u308c\u3067\u306f\u3001\u30af\u30a8\u30ea\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u3055\u3089\u306b\u6df1\u304f\u6398\u308a\u4e0b\u3052\u3066\u3001\u6295\u7a3f\u30ea\u30b9\u30c8\u306e\u4f5c\u6210\u3092\u59cb\u3081\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2 id=\"parameters\">WordPress get_posts \u3067\u30af\u30a8\u30ea\u3092\u4f5c\u6210\u3059\u308b\u65b9\u6cd5<\/h2>\n<p>\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5404\u30ab\u30c6\u30b4\u30ea\u306f\u3001\u540c\u3058\u60c5\u5831\u306b\u95a2\u9023\u3057\u3066\u3044\u307e\u3059\u3002\u305f\u3068\u3048\u3070\u3001ID\u307e\u305f\u306f\u30cb\u30c3\u30af\u30cd\u30fc\u30e0\u3067\u6295\u7a3f\u8005\u3092\u5b9a\u7fa9\u3057\u3001\u6307\u5b9a\u3057\u305f\u6295\u7a3f\u8005\u304b\u3089\u306e\u6295\u7a3f\u3092\u53d6\u5f97\/\u9664\u5916\u3059\u308b\u30af\u30a8\u30ea\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u540c\u69d8\u306b\u3001\u30ab\u30c6\u30b4\u30ea\u3001\u30bf\u30b0\u3001\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u3001\u65e5\u4ed8\u3001\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u306a\u3069\u304b\u3089\u6295\u7a3f\u3092\u53d6\u5f97\u3059\u308b\u30af\u30a8\u30ea\u3082\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u4f7f\u7528\u3057\u3066\u5358\u7d14\u306a\u30af\u30a8\u30ea\u3092\u4f5c\u6210\u3059\u308b\u65b9\u6cd5<\/h3>\n<p>\u591a\u304f\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u3001\u305d\u308c\u304c\u5c5e\u3059\u308b\u30ab\u30c6\u30b4\u30ea\u306b\u95a2\u4fc2\u306a\u304f\u3001\u975e\u5e38\u306b\u3088\u304f\u4f3c\u305f\u65b9\u6cd5\u3067\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002\u305f\u3068\u3048\u3070\u3001\u6b21\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u6295\u7a3f\u8005\u306b\u57fa\u3065\u304d\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u7167\u4f1a\u3067\u304d\u307e\u3059\u3002<\/p>\n<ul>\n<li><code>author<\/code>\u00a0(\u6574\u6570) \u2013 \u6295\u7a3f\u8005ID<\/li>\n<li><code>author_name<\/code>\u00a0(\u6587\u5b57\u5217) \u2013 \u6295\u7a3f\u8005\u306e\u00a0<code>user_nicename<\/code><\/li>\n<li><code>author__in<\/code>\u00a0(\u914d\u5217) \u2013 \u8907\u6570\u306e\u6295\u7a3f\u8005ID\u306e\u914d\u5217<\/li>\n<li><code>author__not_in<\/code>\u00a0(\u914d\u5217) \u2013 \u6392\u9664\u3055\u308c\u308b\u3079\u304d\u8907\u6570\u306e\u6295\u7a3f\u8005ID\u306e\u914d\u5217<\/li>\n<\/ul>\n<p>\u3053\u308c\u3089\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u3069\u306e\u3088\u3046\u306b\u4f7f\u3048\u3070\u3044\u3044\u306e\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<p>\u6b21\u306e\u4f8b\u3067\u306f\u3001\u30d1\u30e9\u30e1\u30fc\u30bf <code>author<\/code> \u306f\u3001ID\u304c\u300c1\u300d\u3067\u3042\u308b\u6295\u7a3f\u8005\u306b\u3088\u3063\u3066\u4f5c\u6210\u3055\u308c\u305f\u6700\u65b0\u306e\u30d6\u30ed\u30b0\u6295\u7a3f\u304c\u5fc5\u8981\u3067\u3042\u308b\u3053\u3068\u3092\u6307\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">$my_posts = get_posts( array( 'author' =&gt; 1 ) );<\/code><\/pre>\n<p>\u300cauthor\u300d\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u4ed6\u306e\u65b9\u6cd5\u3067\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30af\u30a8\u30ea\u4f5c\u6210\u306b\u4f7f\u3046\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">\/\/ return an array of posts from specific authors\n$my_posts = get_posts( array( 'author' =&gt; '1,5,12' ) );<\/code><\/pre>\n<pre><code class=\"language-php\">\/\/ return an array of posts excluding the specified author\n$my_posts = get_posts( array( 'author' =&gt; -1 ) );<\/code><\/pre>\n<p>\u3053\u306e\u3088\u3046\u306b\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5024\u306b\u5fdc\u3058\u3066\u3001\u5358\u4e00\u306e\u6295\u7a3f\u8005\uff08\u6574\u6570\uff09\u3001\u8907\u6570\u306e\u6295\u7a3f\u8005\uff08\u30b3\u30f3\u30de\u533a\u5207\u308a\u306e\u5024\u306e\u30ea\u30b9\u30c8\uff09\u304b\u3089\u306e\u6295\u7a3f\u3001\u307e\u305f\u306f\u7279\u5b9a\u306e\u8457\u8005\u3092\u9664\u5916\u3057\u305f\uff08\u8ca0\u306e\u5024\uff09\u7d50\u679c\u304c\u5f97\u3089\u308c\u307e\u3059\u3002<\/p>\n<p>\u4ed6\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u3001\u67d4\u8edf\u6027\u3092\u9ad8\u3081\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u305f\u3068\u3048\u3070\u3001\u6b21\u306e <code>get_posts<\/code> \u306f\u3001\u8907\u6570\u306e\u6295\u7a3f\u8005\u304b\u3089\u306e\u6700\u65b0\u306e\u30d6\u30ed\u30b0\u6295\u7a3f\u306e\u914d\u5217\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">\/\/ return an array of posts from multiple authors\n$my_posts = get_posts( array( 'author__in' =&gt; array( 1, 5, 12 ) ) );<\/code><\/pre>\n<p>\u305d\u3057\u3066\u3001\u8907\u6570\u306e\u6295\u7a3f\u8005\u3092\u9664\u5916\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">\/\/ return an array of posts from multiple authors\n$my_posts = get_posts( array( 'author__not_in' =&gt; array( 1, 5, 12 ) ) );<\/code><\/pre>\n<p>\u540c\u69d8\u306b\u3001\u30ab\u30c6\u30b4\u30ea\u30d1\u30e9\u30e1\u30fc\u30bf\u3001\u30bf\u30b0\u30d1\u30e9\u30e1\u30fc\u30bf\u3001\u6295\u7a3f\u30bf\u30a4\u30d7\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u4f7f\u7528\u3067\u304d\u307e\u3059\u304c\u3001\u7279\u5b9a\u306e\u9055\u3044\u304c\u3042\u308a\u307e\u3059\u3002\u4f8b\u3068\u3057\u3066\u3001\u30ab\u30c6\u30b4\u30ea\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<ul>\n<li><code>cat<\/code> (<em>int<\/em>)<\/li>\n<li><code>category_name<\/code> (<em>string<\/em>)<\/li>\n<li><code>category__and<\/code> (<em>array<\/em>)<\/li>\n<li><code>category__in<\/code> (<em>array<\/em>)<\/li>\n<li><code>category__not_in<\/code> (<em>array<\/em>)<\/li>\n<\/ul>\n<p>\u3068\u306b\u304b\u304f\u3001\u3059\u3079\u3066\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u3053\u308c\u3089\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u307b\u3069\u4f7f\u3044\u3084\u3059\u3044\u308f\u3051\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u3055\u3089\u306b\u3001\u30ab\u30c6\u30b4\u30ea\u30d1\u30e9\u30e1\u30fc\u30bf\u3001\u6295\u7a3f\u30bf\u30a4\u30d7\u30d1\u30e9\u30e1\u30fc\u30bf\u3001MIME\u30bf\u30a4\u30d7\u30d1\u30e9\u30e1\u30fc\u30bf\u306a\u3069\u3092\u3059\u3079\u3066\u5358\u4e00\u306e\u30af\u30a8\u30ea\u3067\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u7d50\u679c\u3068\u3057\u3066\u53d7\u3051\u53d6\u308b\u30c7\u30fc\u30bf\u306e\u4e2d\u8eab\u3092\u304d\u3081\u7d30\u304b\u304f\u5236\u5fa1\u3067\u304d\u3001\u6295\u7a3f\u30bf\u30a4\u30d7\u3001\u30ab\u30b9\u30bf\u30e0\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u3001\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u5168\u4f53\u306b\u57fa\u3065\u3044\u3066\u3001\u3088\u308a\u9ad8\u5ea6\u306a\u30af\u30a8\u30ea\u3092\u69cb\u7bc9\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u3067\u306f\u3001\u3082\u3046\u5c11\u3057\u5148\u306b\u9032\u307f\u307e\u3057\u3087\u3046\uff01<\/p>\n<h3>WordPress\u3067\u9ad8\u5ea6\u306a\u30af\u30a8\u30ea\u3092\u4f5c\u6210\u3059\u308b\u65b9\u6cd5<\/h3>\n<p>\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3068\u30ab\u30b9\u30bf\u30e0\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u306b\u57fa\u3065\u304f\u3088\u308a\u9ad8\u5ea6\u306a\u30af\u30a8\u30ea\u3092\u4f7f\u7528\u3057\u3066\u3001\u4e00\u6b69\u524d\u9032\u3057\u307e\u3057\u3087\u3046\u3002\u6b21\u306e\u6295\u7a3f\u30bf\u30a4\u30d7\u304c\u3042\u308b\u3068\u3057\u307e\u3059\u3002<\/p>\n<p>\u540d\u524d: book<br \/>\n\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u540d: book_category\u3001book_author<br \/>\n\u5bfe\u5fdc\u3059\u308b\u9805\u76ee: title\u3001 editor\u3001 thumbnail\u3001 excerpt\u3001 custom-fields<\/p>\n<h4>\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u3068\u30ab\u30b9\u30bf\u30e0\u30bf\u30af\u30bd\u30ce\u30df\u30fc<\/h4>\n<p><code>book_category<\/code> \u30ab\u30b9\u30bf\u30e0\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u306e\u6700\u65b0\u306e\u66f8\u7c4d\u306e\u30ea\u30b9\u30c8\u304c\u6b32\u3057\u3044\u3068\u3057\u307e\u3059\u3002\u5f15\u6570\u306e\u914d\u5217\u306f\u6b21\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<pre><code class=\"language-php\">$args = array(\n\t'post_type'\t\t=&gt; 'book',\n\t'tax_query'\t\t=&gt; array(\n\t\tarray(\n\t\t\t'taxonomy'\t=&gt; 'book_category',\n\t\t\t'field'\t\t=&gt; 'slug',\n\t\t\t'terms'\t\t=&gt; 'sci-fi'\n\t\t)\n\t),\n);<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u5f15\u6570\u306f\u3001<code>sci-fi book_category<\/code> \u306b\u3042\u308b\u3059\u3079\u3066\u306e\u672c\u3092\u53d6\u5f97\u3059\u308b\u3088\u3046\u306bWordPress\u306b\u6307\u793a\u3057\u307e\u3059\u3002<\/p>\n<p><code>tax_query<\/code> \u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u3001\u5f15\u6570\u914d\u5217\u306e\u914d\u5217\uff08\u3064\u307e\u308a\u914d\u5217\u306e\u914d\u5217\uff09\u3092\u53d6\u308a\u307e\u3059\u3002\u3053\u306e\u3088\u3046\u306b\u30cd\u30b9\u30c8\u69cb\u9020\u306b\u3042\u308b\u914d\u5217\u306b\u3088\u308a\u3001\u4ee5\u4e0b\u306e\u4f8b\u306b\u793a\u3059\u3088\u3046\u306b\u3001\u8907\u6570\u306e\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u306b\u57fa\u3065\u3044\u3066\u975e\u5e38\u306b\u8907\u96d1\u306a\u30af\u30a8\u30ea\u304c\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">$args = array(\n\t'numberposts'\t=&gt; 10,\n\t'post_type'\t\t=&gt; 'book',\n\t'relation'\t\t=&gt; 'AND',\n\t'tax_query'\t\t=&gt; array(\n\t\tarray(\n\t\t\t'taxonomy'\t=&gt; 'book_category',\n\t\t\t'field'\t\t=&gt; 'slug',\n\t\t\t'terms'\t\t=&gt; 'sci-fi'\n\t\t),\n\t\tarray(\n\t\t\t'taxonomy'\t=&gt; 'book_author',\n\t\t\t'field'\t\t=&gt; 'term_id',\n\t\t\t'terms'\t\t=&gt; 22\n\t\t)\n\t)\n);<\/code><\/pre>\n<p>\u3053\u308c\u3089\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306b\u3088\u308a\u3001ID\u304c#22\u306e <code>book_author<\/code> \u304c\u4f5c\u6210\u3057\u305f <code>sci-fi<\/code> <code>book_category<\/code> \u306e\u6700\u65b0\u306e10\u306e <code>book<\/code> \u6295\u7a3f\u30bf\u30a4\u30d7\u306e\u30ea\u30b9\u30c8\u3092\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<code>relation<\/code> \u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u3001 <code>tax_query<\/code> \u306b\u30ea\u30b9\u30c8\u3055\u308c\u3066\u3044\u308b\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u305d\u308c\u305e\u308c\u306e\u9593\u306e\u8ad6\u7406\u7684\u306a\u95a2\u4fc2\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002\u4e0a\u8a18\u3067\u306f\u3001<code>sci-fi<\/code> \u30ab\u30c6\u30b4\u30ea\u306b\u5c5e\u3059\u308b\u3001\u304b\u3064\u3001\u8457\u8005#22\u306b\u3088\u3063\u3066\u4f5c\u6210\u3055\u308c\u305f\u3059\u3079\u3066\u306e\u66f8\u7c4d\u3092\u53d6\u5f97\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067\u3001\u5024\u3092 <code>AND<\/code> \u306b\u8a2d\u5b9a\u3057\u307e\u3057\u305f\u3002<\/p>\n<h4>\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u4f7f\u7528\u3057\u3066\u30e1\u30bf\u30af\u30a8\u30ea\u3092\u4f5c\u6210\u3059\u308b\u65b9\u6cd5<\/h4>\n<p>\u6642\u306b\u3001\u7279\u5b9a\u306e\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u30ad\u30fc\u3084\u5024\u306b\u57fa\u3065\u3044\u3066\u6295\u7a3f\u306e\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u3082\u3042\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n<pre><code class=\"language-php\">$args = array(\n\t'meta_key'\t\t=&gt; 'cover',\n\t'meta_value'\t=&gt; 'paperback',\n\t'meta_compare'\t=&gt; '='\n);<\/code><\/pre>\n<p>\u3053\u308c\u3089\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u30ad\u30fc\u3068\u5024\u304b\u3089\u3059\u3079\u3066\u306e\u6295\u7a3f\u3092\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002 <code>meta_compare<\/code> \u306f\u3001 <code>meta_value<\/code> \u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5024\u3092\u30c6\u30b9\u30c8\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a\u6f14\u7b97\u5b50\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002\u3053\u3053\u3067\u306f\u3001<code>meta_value<\/code> \u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u3067\u3082\u3042\u308b <code>=<\/code> \u3067\u3059\u3002<\/p>\n<p>\u5229\u7528\u53ef\u80fd\u306a\u5024\u306f<code>=<\/code>\u3001<code>!=<\/code>\u3001<code>&gt;<\/code>\u3001<code>&gt;=<\/code>\u3001<code>&lt;<\/code>\u3001<code>&lt;=<\/code>\u3001<code>LIKE<\/code>\u3001<code>NOT LIKE<\/code>\u3001<code>IN<\/code>\u3001<code>NOT IN<\/code>\u3001<code>BETWEEN<\/code>\u3001<code>NOT BETWEEN<\/code>\u3001<code>NOT EXISTS<\/code>\u3001<code>REGEXP<\/code>\u3001<code>NOT REGEXP<\/code>\u307e\u305f\u306f<code>RLIKE<\/code>\u3067\u3059\u3002<\/p>\n<p>\u3053\u308c\u306f\u975e\u5e38\u306b\u7c21\u5358\u306a\u4f8b\u3067\u3059\u304c\u3001\u3088\u308a\u9ad8\u5ea6\u306a\u30af\u30a8\u30ea\u3082\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002\u6b21\u306e\u4f8b\u3067\u306f\u30012010\u5e74\u4ee5\u964d\u306b\u767a\u884c\u3055\u308c\u305f\u30d5\u30a1\u30f3\u30bf\u30b8\u30fc\u306e\u672c\u306b\u3064\u3044\u3066\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u30af\u30a8\u30ea\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">$args = array(\n\t'post_type'\t\t=&gt; 'book',\n\t'meta_key'\t\t=&gt; 'year_published',\n\t'meta_value_num'\t=&gt; 2010,\n\t'meta_compare'\t=&gt; '&gt;',\n\t'tax_query'\t\t=&gt; array(\n\t\tarray(\n\t\t\t'taxonomy'\t=&gt; 'book_category',\n\t\t\t'field'\t\t=&gt; 'slug'\n\t\t\t'terms'\t\t=&gt; 'fantasy'\n\t\t)\n\t)\n);<\/code><\/pre>\n<p>\u305d\u3057\u3066\u3001\u3055\u3089\u306b\u5148\u3078\u9032\u3080\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u6b21\u306e\u4f8b\u3067\u306f\u3001\u30ab\u30b9\u30bf\u30e0\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u3092\u6301\u3064\u6295\u7a3f\u30bf\u30a4\u30d7\u3068\u30012\u3064\u306e\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u6df7\u5728\u3055\u305b\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">$args = array(\n\t'post_type'\t\t=&gt; 'book',\n\t'tax_query'\t\t=&gt; array(\n\t\tarray(\n\t\t\t'taxonomy'\t=&gt; 'book_category',\n\t\t\t'field'\t\t=&gt; 'slug'\n\t\t\t'terms'\t\t=&gt; array( 'fantasy' )\n\t\t)\n\t),\n\t'meta_query'\t=&gt; array(\n\t\t'relation'\t\t=&gt; 'AND',\n\t\tarray(\n\t\t\t'key'\t\t=&gt; 'year_published',\n\t\t\t'value'\t\t=&gt; 2010,\n\t\t\t'type'\t\t=&gt; 'numeric',\n\t\t\t'compare'\t=&gt; '&gt;',\n\t\t),\n\t\tarray(\n\t\t\t'key'\t\t=&gt; 'price',\n\t\t\t'value'\t\t=&gt; array( 10, 25 ),\n\t\t\t'type'\t\t=&gt; 'numeric',\n\t\t\t'compare'\t=&gt; 'BETWEEN',\n\t\t)\n\t)\n);<\/code><\/pre>\n<p>\u3053\u3053\u3067\u306f\u3001\u4e00\u9023\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u30012010\u5e74\u4ee5\u964d\u306b\u767a\u884c\u3055\u308c\u305f\u30d5\u30a1\u30f3\u30bf\u30b8\u30fc\u672c\u306e\u30ea\u30b9\u30c8\u3092\u53d6\u5f97\u3057\u3066\u3044\u307e\u3059\u3002\u672c\u306e\u4fa1\u683c\u306f10\u30c9\u30eb\u304b\u308925\u30c9\u30eb\uff08<code>BETWEEN<\/code>\uff09\u3067\u3059\u3002<\/p>\n<p><code>meta_query<\/code> \u30d1\u30e9\u30e1\u30fc\u30bf\u304c <code>tax_query<\/code> \u30d1\u30e9\u30e1\u30fc\u30bf\u3068\u3088\u304f\u4f3c\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002\u914d\u5217\u306e\u307e\u3068\u307e\u308a\u3092\u69cb\u6210\u3059\u308b\u305f\u3081\u3001\u8907\u6570\u306e\u30e1\u30bf\u30ad\u30fc\/\u5024\u306e\u30da\u30a2\u306b\u57fa\u3065\u3044\u3066\u9ad8\u5ea6\u306a\u30af\u30a8\u30ea\u304c\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002\u30af\u30a8\u30ea\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5305\u62ec\u7684\u306a\u30ea\u30b9\u30c8\u3068\u591a\u6570\u306e\u4f8b\u306b\u3064\u3044\u3066\u306f\u3001 <a href=\"https:\/\/developer.wordpress.org\/reference\/classes\/wp_query\/\">WP_Query\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c6\u30fc\u30b7\u30e7\u30f3<\/a>\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>get_posts\u304c5\u3064\u306eWordPress\u306e\u6295\u7a3f\u306b\u9650\u5b9a\u3055\u308c\u3066\u3044\u308b\u7406\u7531\u3068\u306f\uff1f<\/h3>\n<p><code>get_posts<\/code> \u95a2\u6570\u306f <code>WP_Query::parse_query()<\/code>\u3068\u540c\u3058\u5f15\u6570\u3092\u53d6\u308a\u307e\u3059\u304c\uff08<a href=\"https:\/\/developer.wordpress.org\/reference\/classes\/WP_Query\/parse_query\/\">Codex\u3092\u53c2\u7167<\/a>\uff09\u3001\u3044\u304f\u3064\u304b\u306e\u7279\u5b9a\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306f <code>WP_Query<\/code> \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u306f\u5c11\u3057\u7570\u306a\u308b\u52d5\u4f5c\u3092\u3057\u307e\u3059\u3002<\/p>\n<p>\u30af\u30a8\u30ea\u3067 <code>numberposts<\/code> \u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u4f7f\u7528\u3057\u3066\u3044\u306a\u3044\u306f\u305a\u306a\u306e\u306b\u3001\u30ea\u30b9\u30c8\u306b5\u3064\u306e\u30a2\u30a4\u30c6\u30e0\u3057\u304b\u8868\u793a\u3055\u308c\u306a\u3044\u2026\u4e00\u4f53\u3001\u306a\u305c\u3001\u305d\u3093\u306a\u3053\u3068\u304c\u8d77\u3053\u308b\u306e\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u3001\u300c\u8a2d\u5b9a\u300d\u2192\u300c\u8868\u793a\u8a2d\u5b9a\u300d\u306e\u7ba1\u7406\u30da\u30fc\u30b8\u3067\u8a2d\u5b9a\u3057\u305f\u6295\u7a3f\u306e\u6570\u306b\u3088\u3063\u3066\u3001WordPress\u30af\u30a8\u30ea\u306b\u3088\u3063\u3066\u53d6\u5f97\u3055\u308c\u308b\u6295\u7a3f\u306e\u6570\u304c\u6c7a\u307e\u308a\u307e\u3059\u3002\u3068\u306b\u304b\u304f\u3001 <code>numberposts<\/code> \u3084 <code>posts_per_page<\/code> \u306b\u30ab\u30b9\u30bf\u30e0\u5024\u3092\u6307\u5b9a\u3057\u306a\u3044\u5834\u5408\u3001 <code>get_posts<\/code> \u306f\u7570\u306a\u308b\u6570\u306e\u6295\u7a3f\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li><code>numberposts<\/code>\u306f\u53d6\u5f97\u3059\u308b\u6295\u7a3f\u306e\u7dcf\u6570\u3067\u3059\u3002\u3053\u308c\u306f<code>WP_Query<\/code>\u306e<code>posts_per_page<\/code>\u306e\u30a8\u30a4\u30ea\u30a2\u30b9\u3067\u3059\u304c\u30012\u3064\u306b\u306f\u9055\u3044\u304c\u3042\u308a\u307e\u3059\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u3001<code><strong>get_posts<\/strong><\/code> \u306e\u4f7f\u7528\u6642\u306b\u53d6\u5f97\u3059\u308b\u6295\u7a3f\u306e\u6570\u306f<strong>5<\/strong>\u3067\u3059\u304c\u3001 <code>WP_Query<\/code> \u306e <code>posts_per_page<\/code> \u306b\u304a\u3051\u308b\u30c7\u30d5\u30a9\u30eb\u30c8\u306f\u3042\u306a\u305f\u306eWordPress\u30b5\u30a4\u30c8\u306e\u30da\u30fc\u30b8\u6bce\u306e\u6295\u7a3f\u6570\u306b\u306a\u308a\u307e\u3059\u3002\u5f15\u6570\u306e\u914d\u5217\u3067 <code>numberposts<\/code> \u307e\u305f\u306f <code>posts_per_page<\/code> \u306e\u30ab\u30b9\u30bf\u30e0\u5024\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u306b\u3088\u308a\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u3092\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3067\u304d\u307e\u3059\u3002<\/li>\n<\/ul>\n<p><code>numberposts<\/code> \u306b\u52a0\u3048\u3066\u3001\u4ee5\u4e0b\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306f <code>get_posts<\/code> \u306b\u56fa\u6709\u306e\u3082\u306e\u3067\u3059\u3002<\/p>\n<ul>\n<li><code>category<\/code>\u306f\u30b3\u30f3\u30de\u3067\u533a\u5207\u3063\u305f\u30ab\u30c6\u30b4\u30eaID\u306e\u30ea\u30b9\u30c8\u3067\u3059\u3002<code>WP_Query<\/code>\u306e<code>cat<\/code>\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u30a8\u30a4\u30ea\u30a2\u30b9\u3067\u3059\u3002<\/li>\n<li><code>include<\/code>\u306f\u30b3\u30f3\u30de\u3067\u533a\u5207\u3063\u305f\u6295\u7a3fID\u306e\u30ea\u30b9\u30c8\u3067\u3059\u3002<code>WP_Query<\/code>\u306e<code>post__in<\/code>\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u30a8\u30a4\u30ea\u30a2\u30b9\u3067\u3059\u3002<\/li>\n<li><code>exclude<\/code>\u306f\u30b3\u30f3\u30de\u3067\u533a\u5207\u3063\u305f\u6295\u7a3fID\u306e\u30ea\u30b9\u30c8\u3067\u3059\u3002<\/li>\n<li><code>suppress_filters<\/code>\u306f\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u3092\u7121\u52b9\u306b\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u6c7a\u3081\u307e\u3059\u3002\u3053\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306f\u00a0<code>get_posts<\/code>\u3067\u306f<code>true<\/code>\u3067\u3001<code>WP_Query<\/code>\u00a0\u3067\u306f<code>false<\/code>\u3068\u306a\u3063\u3066\u3044\u307e\u3059\uff08<a href=\"https:\/\/core.trac.wordpress.org\/browser\/tags\/5.2\/src\/wp-includes\/class-wp-query.php#L709\">Track\u3092\u53c2\u7167<\/a>\uff09\u3002<\/li>\n<\/ul>\n<p>\u95a2\u6570\u306f\u3001 <code>wp-includes\/post.php<\/code> \u3067\u5b9a\u7fa9\u3055\u308c\u307e\u3059\u3002 <a href=\"https:\/\/core.trac.wordpress.org\/browser\/tags\/5.2\/src\/wp-includes\/post.php#L1901\">Track (WordPress 5.2)<\/a> \u307e\u305f\u306f\u30ed\u30fc\u30ab\u30eb\u306eWordPress\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30d5\u30a1\u30a4\u30eb\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u304b\u3089\u3001 <code>get_posts<\/code> \u306e\u4ed5\u7d44\u307f\u3092\u6df1\u304f\u6398\u308a\u4e0b\u3052\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>\u30a2\u30a4\u30c6\u30e0\u306e\u9806\u5e8f\u3065\u3051<\/h3>\n<p><code>orderby<\/code>\u00a0\u3084\u00a0<code>order<\/code>\u00a0\u306f\u7d50\u679c\u3068\u3057\u3066\u7372\u5f97\u3057\u305f\u30a2\u30a4\u30c6\u30e0\u306e\u9806\u5e8f\u3065\u3051\u3092\u884c\u3044\u307e\u3059\u3002<code>ID<\/code>\u3001\u00a0<code>author<\/code>\u3001\u00a0<code>title<\/code>\u3001\u00a0<code>name<\/code>\u3001\u00a0<code>type<\/code>\u3001\u00a0<code>date<\/code>\u3001\u00a0<code>modified<\/code>\u3001\u00a0<code>parent<\/code>\u3001\u00a0<code>rand<\/code>\u3001\u00a0<code>comment_count<\/code> \u305d\u306e\u4ed6\u305f\u304f\u3055\u3093\u306e\u65b9\u6cd5\u3067\u3001\u6607\u9806\/\u964d\u9806\u3092\u8a2d\u5b9a\u3057\u306a\u304c\u3089\u3001\u4e26\u3079\u66ff\u3048\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u7c21\u5358\u306a\u30af\u30a8\u30ea\u304c\u3042\u308b\u5834\u5408\u306f\u3001<code>order<\/code>\u3084\u00a0 <code>orderby<\/code> \u306e\u5024\u3092\u8a2d\u5b9a\u3059\u308b\u3060\u3051\u3067OK\u3067\u3059\u3002\u6b21\u306e\u4f8b\u3067\u306f\u3001\u6295\u7a3f\u306f\u6295\u7a3f\u540d\u306e\u6607\u9806\u3067\u4e26\u3079\u66ff\u3048\u3089\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">$args = array(\n\t'author'\t=&gt; '1,5,12',\n\t'orderby'\t=&gt; 'name',\n\t'order'\t\t=&gt; 'ASC'\n);<\/code><\/pre>\n<p>\u975e\u5e38\u306b\u30b7\u30f3\u30d7\u30eb\u3067\u3059\u3002\u3067\u306f\u3001\u8907\u96d1\u306a\u30af\u30a8\u30ea\u304c\u3042\u308b\u5834\u5408\u306f\u3069\u3046\u3067\u3057\u3087\u3046\u304b\uff1f\u3064\u307e\u308a\u3001\u9ad8\u5ea6\u306a\u30e1\u30bf\u30af\u30a8\u30ea\u3067\u30011\u3064\u3084\u8907\u6570\u306e\u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u5024\u3067\u30a2\u30a4\u30c6\u30e0\u3092\u4e26\u3079\u66ff\u3048\u308b\u3053\u3068\u306f\u3067\u304d\u308b\u306e\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<p>WordPress 4.0\u3001<a href=\"https:\/\/make.wordpress.org\/core\/2015\/03\/30\/query-improvements-in-wp-4-2-orderby-and-meta_query\/\">WordPress 4.2<\/a>\u306f\u3001<code>orderby<\/code> \u3068\u00a0 <code>meta_query<\/code> \u30d1\u30e9\u30e1\u30fc\u30bf\u306b\u91cd\u8981\u306a\u6539\u5584\u3092\u3082\u305f\u3089\u3057\u307e\u3057\u305f\u3002\u30e1\u30bf\u30af\u30a8\u30ea\u306e\u7279\u5b9a\u306e\u7bc0\u306b\u3088\u308b\u9806\u5e8f\u4ed8\u3051\u304c\u53ef\u80fd\u306b\u306a\u308b\u65b0\u3057\u3044\u69cb\u6587\u304c\u7528\u610f\u3055\u308c\u305f\u306e\u3067\u3059\u3002\u3053\u306e\u65b0\u3057\u3044\u69cb\u6587\u306e\u304a\u304b\u3052\u3067\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f7f\u7528\u3057\u3066\u3001 <code>orderby<\/code> \u30d1\u30e9\u30e1\u30fc\u30bf\u304b\u3089\u30e1\u30bf\u30af\u30a8\u30ea\u306e\u7279\u5b9a\u306e\u7bc0\u3078\u53c2\u7167\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u3088\u3046\u306a\u6539\u5584\u306b\u3088\u308a\u3001\u4e0a\u8a18\u306e\u4f8b\u306e\u30e1\u30bf\u30af\u30a8\u30ea\u306f\u6b21\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">$args = array(\n\t'meta_query'\t=&gt; array(\n\t\t'relation'\t\t=&gt; 'AND',\n\t\t'year_clause' =&gt; array(\n\t\t\t'key'\t\t=&gt; 'year_published',\n\t\t\t'value'\t\t=&gt; 2010,\n\t\t\t'type'\t\t=&gt; 'numeric',\n\t\t\t'compare'\t=&gt; '&gt;',\n\t\t),\n\t\t'price_clause' =&gt; array(\n\t\t\t'key'\t\t=&gt; 'price',\n\t\t\t'value'\t\t=&gt; array( 10, 25 ),\n\t\t\t'type'\t\t=&gt; 'numeric',\n\t\t\t'compare'\t=&gt; 'BETWEEN',\n\t\t)\n\t),\n\t'orderby' =&gt; 'price_clause',\n);<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u4f8b\u3067\u306f\u3001<code>price_clause<\/code> \u3067\u8981\u7d20\u3092\u9806\u5e8f\u4ed8\u3051\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3055\u3089\u306b\u591a\u304f\u306e\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<a href=\"https:\/\/make.wordpress.org\/core\/2014\/08\/29\/a-more-powerful-order-by-in-wordpress-4-0\/\">WordPress 4.0<\/a>\u3067\u306f\u3001\u6b21\u306e\u4f8b\u306b\u793a\u3059\u3088\u3046\u306b\u3001\u5358\u4e00\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3067\u306f\u306a\u304f\u3001\u30e1\u30bf\u30af\u30a8\u30ea\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u914d\u5217\u3092 <code>get_posts<\/code> \u306b\u6e21\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">$args = array(\n\t'meta_query'\t=&gt; array(\n\t\t'relation'\t\t=&gt; 'AND',\n\t\t'year_clause' =&gt; array(\n\t\t\t'key'\t\t=&gt; 'year_published',\n\t\t\t'value'\t\t=&gt; 2010,\n\t\t\t'type'\t\t=&gt; 'numeric',\n\t\t\t'compare'\t=&gt; '&gt;',\n\t\t),\n\t\t'price_clause' =&gt; array(\n\t\t\t'key'\t\t=&gt; 'price',\n\t\t\t'value'\t\t=&gt; array( 10, 25 ),\n\t\t\t'type'\t\t=&gt; 'numeric',\n\t\t\t'compare'\t=&gt; 'BETWEEN',\n\t\t)\n\t),\n\t'orderby' =&gt; array( 'price_clause' =&gt; 'ASC', 'year_clause' =&gt; 'DESC' ),\n);<\/code><\/pre>\n<p>\u9ad8\u5ea6\u306a\u30e1\u30bf\u30af\u30a8\u30ea\u3092\u4f5c\u6210\u3057\u3001\u6700\u521d\u306b <code>price_clause<\/code> \u3067\u6607\u9806\u3001\u6b21\u306b <code>year_clause<\/code> \u3067\u964d\u9806\u3067\u7d50\u679c\u3092\u4e26\u3079\u66ff\u3048\u307e\u3057\u305f\u3002<\/p>\n<p>Codex\u304b\u3089<a href=\"https:\/\/developer.wordpress.org\/reference\/classes\/wp_query\/#order-orderby-parameters\">\u4e26\u3079\u66ff\u3048\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u5168\u30ea\u30b9\u30c8<\/a>\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u6b21\u306f\u30d5\u30ed\u30f3\u30c8\u30da\u30fc\u30b8\u306b\u30c7\u30fc\u30bf\u3092\u8868\u793a\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u304a\u3059\u3059\u3081\u306e\u8a18\u4e8b:\u00a0<a href=\"https:\/\/kinsta.com\/jp\/blog\/phpinfo\/\">phpinfo\u30da\u30fc\u30b8\u3092\u7c21\u5358\u306b\u4f5c\u6210\u3001\u4f7f\u7528\u3059\u308b\u65b9\u6cd5<\/a><\/p>\n<h2 id=\"display\">get_posts\u3067\u8fd4\u3055\u308c\u305f\u30c7\u30fc\u30bf\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5<\/h2>\n<p>WordPress\u306e <code>get_posts<\/code> \u306f<a href=\"https:\/\/developer.wordpress.org\/reference\/classes\/wp_post\/\"><code>WP_Post<\/code>\u00a0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/a>\u3092\u8fd4\u3057\u3001 <code>wp_posts<\/code> \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30c6\u30fc\u30d6\u30eb\u306b\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u9078\u629e\u3055\u308c\u305f\u5404\u6295\u7a3f\u306e\u5909\u6570\u304c\u5229\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li>ID<\/li>\n<li>post_author<\/li>\n<li>post_name<\/li>\n<li>post_type<\/li>\n<li>post_title<\/li>\n<li>post_date<\/li>\n<li>post_date_gmt<\/li>\n<li>post_content<\/li>\n<li>post_excerpt<\/li>\n<li>post_status<\/li>\n<li>comment_status<\/li>\n<li>ping_status<\/li>\n<li>post_password<\/li>\n<li>post_parent<\/li>\n<li>post_modified<\/li>\n<li>post_modified_gmt<\/li>\n<li>comment_count<\/li>\n<li>menu_order<\/li>\n<\/ul>\n<figure style=\"width: 2176px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2019\/08\/wp-posts-table-1.png\" alt=\"phpMyAdmin\u306ewp_posts\u30c6\u30fc\u30d6\u30eb\u306e\u69cb\u9020\" width=\"2176\" height=\"1542\"><figcaption class=\"wp-caption-text\">phpMyAdmin\u306ewp_posts\u30c6\u30fc\u30d6\u30eb\u306e\u69cb\u9020<\/figcaption><\/figure>\n<p>\u6b21\u306e\u3088\u3046\u306a <code>foreach<\/code> \u30b5\u30a4\u30af\u30eb\u3067\u3053\u308c\u3089\u306e\u30c7\u30fc\u30bf\u306b\u7c21\u5358\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">$custom_posts = get_posts( $args );\n\nif( ! empty( $custom_posts ) ){\n\t$output = '&lt;ul&gt;';\n\tforeach ( $custom_posts as $p ){\n\n\t\t$output .= '&lt;li&gt;&lt;a href=\"' \n\t\t. get_permalink( $p-&gt;ID ) . '\"&gt;' \n\t\t. $p-&gt;post_title . '&lt;\/a&gt;&lt;\/li&gt;';\n\t}\n\n\t$output .= '&lt;\/ul&gt;';\n}\n\nreturn $output ?? '&lt;strong&gt;Sorry. No posts matching your criteria!&lt;\/strong&gt;';<\/code><\/pre>\n<p><code>get_posts<\/code> \u304c\u5c11\u306a\u304f\u3068\u30821\u3064\u306e\u6295\u7a3f\u3092\u898b\u3064\u3051\u308b\u3068\u3001\u4e00\u9023\u306e\u30a2\u30a4\u30c6\u30e0\u304c\u8fd4\u3055\u308c\u3001\u305d\u308c\u3092\u8d70\u67fb\u3057\u3066\u3001\u6295\u7a3f\u306e\u30bf\u30a4\u30c8\u30eb\u3068\u5143\u306e\u6295\u7a3f\u3078\u306e\u30ea\u30f3\u30af\u3092\u8868\u793a\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u5bfe\u5fdc\u3059\u308b <code>WP_Post<\/code> \u5909\u6570\u304c\u306a\u3044\u305f\u3081\u3001 <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/get_permalink\/\"><code>get_permalink<\/code>\u00a0\u95a2\u6570<\/a>\u3092\u4f7f\u7528\u3057\u3066\u6295\u7a3f\u306e\u30d1\u30fc\u30de\u30ea\u30f3\u30af\u3092\u53d6\u5f97\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u3053\u307e\u3067\u306f\u975e\u5e38\u306b\u30b7\u30f3\u30d7\u30eb\u3067\u3059\u304c\u3001WordPress <code>get_posts<\/code> \u3092\u4f7f\u7528\u3057\u3066\u305d\u306e\u30b3\u30fc\u30c9\u3092\u5b9f\u88c5\u3057\u3001\u6295\u7a3f\u306e\u30ab\u30b9\u30bf\u30e0\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\u3059\u308b\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u3088\u3044\u306e\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<p>\u30da\u30fc\u30b8\u306b\u6295\u7a3f\u306e\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u306b\u306f\u3001\u3044\u304f\u3064\u304b\u306e\u65b9\u6cd5\u304c\u8003\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/kinsta.com\/jp\/blog\/wordpress-child-theme\/\">\u5b50\u30c6\u30fc\u30de\u306e\u30da\u30fc\u30b8\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8<\/a>\u3092\u7de8\u96c6\u3059\u308b\u3053\u3068\u3067\u3001\u30da\u30fc\u30b8\u306e\u3069\u3053\u304b\u306b\u8868\u793a\u3059\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3059\u308b<\/li>\n<li><a href=\"https:\/\/kinsta.com\/jp\/blog\/wordpress-widgets\/\">\u30b5\u30a4\u30c9\u30d0\u30fc\u30a6\u30a3\u30b8\u30a7\u30c3\u30c8<\/a>\u306b\u7d44\u307f\u8fbc\u3080<\/li>\n<li><a href=\"https:\/\/kinsta.com\/jp\/blog\/wordpress-shortcodes\/\">\u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9<\/a>\u3092\u4f7f\u3063\u3066\u3001\u6295\u7a3f\u306e\u30b3\u30f3\u30c6\u30f3\u30c4\u5185\u306b\u8868\u793a\u3059\u308b<\/li>\n<\/ul>\n<h2 id=\"example\">\u5b9f\u8df5\u7de8\uff1a\u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\u3067\u30a2\u30a4\u30c6\u30e0\u306e\u30ab\u30b9\u30bf\u30e0\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5<\/h2>\n<p>\u30b3\u30f3\u30c6\u30f3\u30c4\u306b\u7d44\u307f\u8fbc\u3080\u3053\u3068\u306e\u3067\u304d\u308b\u3001\u7d20\u65e9\u304f\u7c21\u5358\u306a\u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\u4f5c\u6210\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<a href=\"https:\/\/kinsta.com\/jp\/blog\/wordpress-shortcodes\/\">\u4ee5\u524d\u306e\u8a18\u4e8b<\/a>\u3067\u65e2\u306b\u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\u81ea\u4f53\u3092\u6271\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u3053\u308c\u306b\u3064\u3044\u3066\u306f\u3001\u3053\u3053\u3067\u306f\u6df1\u304f\u6398\u308a\u4e0b\u3052\u307e\u305b\u3093\u3002<\/p>\n<p>\u307e\u305a\u3001 <a href=\"https:\/\/kinsta.com\/jp\/blog\/install-wordpress-locally\/\">\u30ed\u30fc\u30ab\u30ebWordPress\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a>\u306e <code>wp-content\/plugins<\/code>\u30d5\u30a9\u30eb\u30c0\u307e\u305f\u306f<a href=\"https:\/\/kinsta.com\/jp\/docs\/wordpress-hosting\/staging-environment\/\">\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u74b0\u5883<\/a>\u306b\u65b0\u3057\u3044\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u3053\u306e\u4f8b\u3067\u306f\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092<strong>kinsta-shortcodes<\/strong>\u3068\u540d\u4ed8\u3051\u307e\u3057\u305f\u3002<\/p>\n<p><code>wp-content\/plugins\/<strong>kinsta-shortcodes<\/strong>\/<\/code> \u306b\u65b0\u898f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3068\u540c\u3058\u540d\u524d\u306e.php\u30d5\u30a1\u30a4\u30eb <code>kinsta-shortcodes.php<\/code> \u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/kinsta.com\/jp\/blog\/best-text-editors\/\">\u304a\u4f7f\u3044\u306e\u4efb\u610f\u306e\u30c6\u30ad\u30b9\u30c8\u30a8\u30c7\u30a3\u30bf<\/a>\u3067\u65b0\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304d\u3001\u6b21\u306e\u5185\u5bb9\u3092\u4e00\u756a\u4e0a\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">&lt;?php\n\/**\n * @package Kinsta_shortcodes\n * @version 1.0\n *\/\n\/*\nPlugin Name: Kinsta shortcodes\nPlugin URI: http:\/\/wordpress.org\/extend\/plugins\/#\nDescription: This is an example plugin \nAuthor: Your Name\nVersion: 1.0\nAuthor URI: https:\/\/yourwebsite.com\/\n*\/<\/code><\/pre>\n<p>\u65b0\u3057\u3044\u30d7\u30e9\u30b0\u30a4\u30f3\u304c\u3067\u304d\u307e\u3057\u305f\u304c\u3001\u307e\u3060\u4f55\u306e\u6a5f\u80fd\u3082\u3042\u308a\u307e\u305b\u3093\u3002 <a href=\"https:\/\/kinsta.com\/jp\/blog\/wordpress-admin\/\">WordPress\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9<\/a>\u306e\u300c\u30d7\u30e9\u30b0\u30a4\u30f3\u300d\u7ba1\u7406\u753b\u9762\u306b\u79fb\u52d5\u3057\u3001\u65b0\u3057\u3044\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u6709\u52b9\u5316\uff08 <code>wp-config.php<\/code> \u3067 <code>WP_DEBUG<\/code> \u304c <code>true<\/code> \u306b\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\uff09\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3067\u3001\u30b5\u30f3\u30c9\u30dc\u30c3\u30af\u30b9\u306b\u30b3\u30fc\u30c9\u3092\u8a18\u8ff0\u3059\u308b\u6e96\u5099\u304c\u6574\u3044\u307e\u3057\u305f\u3002\u6b21\u306e\u624b\u9806\u306f\u3001\u30ab\u30b9\u30bf\u30e0\u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\u306e\u30d5\u30c3\u30af\u3092\u767b\u9332\u3059\u308b\u3053\u3068\u3067\u3059\u3002<\/p>\n<pre><code class=\"language-php\">\/**\n * Add a hook for a shortcode tag\n *\/\nfunction kinsta_shortcodes_init(){\n\tadd_shortcode( 'kinsta_get_posts', 'kinsta_get_posts_cb' );\n}\nadd_action('init', 'kinsta_shortcodes_init');<\/code><\/pre>\n<p><code>kinsta_get_posts<\/code> \u304c\u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\u540d\u3067\u3001 <code>kinsta_get_posts_cb<\/code> \u306f\u4ee5\u4e0b\u3067\u5b9a\u7fa9\u3055\u308c\u308b\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3067\u3059\u3002<\/p>\n<pre><code class=\"language-php\">\/**\n * Register a shortcode\n *\n * @param array $atts Array of shortcode attributes\n *\/\nfunction kinsta_get_posts_cb( $atts ){\n\n\t\/\/ safely extract custom arguments and set default values\n\textract( shortcode_atts(\n\t\t\tarray(\n\t\t\t\t'numberposts'\t\t=&gt; 3,\n\t\t\t\t'post_type'\t\t\t=&gt; 'post',\n\t\t\t\t'book_category'\t\t=&gt; 'fantasy',\n\t\t\t\t'year_published'\t=&gt; 1900,\n\t\t\t\t'price_min'\t\t\t=&gt; 0,\n\t\t\t\t'price_max'\t\t\t=&gt; 50\n\t\t\t),\n\t\t\t$atts,\n\t\t\t'kinsta_get_posts'\n\t\t) );\n\n\t\/\/ define the array of query arguments\n\t$args = array(\n\t\t'numberposts'\t=&gt; $numberposts,\n\t\t'post_type'\t\t=&gt; $post_type,\n\t\t'tax_query'\t\t=&gt; array(\n\t\t\tarray(\n\t\t\t\t'taxonomy'\t=&gt; 'book_category',\n\t\t\t\t'field'\t\t=&gt; 'slug',\n\t\t\t\t'terms'\t\t=&gt; $book_category,\n\t\t\t)\n\t\t),\n\t\t'meta_query'\t=&gt; array(\n\t\t\t'relation'\t\t=&gt; 'AND',\n\t\t\t'year_clause'\t=&gt; array(\n\t\t\t\t'key'\t\t=&gt; 'year_published',\n\t\t\t\t'value'\t\t=&gt; $year_published,\n\t\t\t\t'type'\t\t=&gt; 'numeric',\n\t\t\t\t'compare'\t=&gt; '&gt;',\n\t\t\t),\n\t\t\t'price_clause'\t=&gt; array(\n\t\t\t\t'key'\t\t=&gt; 'price',\n\t\t\t\t'value'\t\t=&gt; array( $price_min, $price_max ),\n\t\t\t\t'type'\t\t=&gt; 'numeric',\n\t\t\t\t'compare'\t=&gt; 'BETWEEN',\n\t\t\t)\n\t\t),\n\t\t'orderby' =&gt; array( 'price_clause' =&gt; 'ASC' )\n\t);\n\n\t$custom_posts = get_posts( $args );\n\n\tif( ! empty( $custom_posts ) ){\n\t\t$output = '&lt;ul&gt;';\n\t\tforeach ( $custom_posts as $p ){\n\n\t\t\t$output .= '&lt;li&gt;&lt;a href=\"' \n\t\t\t. get_permalink( $p-&gt;ID ) . '\"&gt;' \n\t\t\t. $p-&gt;post_title . '&lt;\/a&gt; (' \n\t\t\t. get_post_meta( $p-&gt;ID, 'year_published', true ) \n\t\t\t. ') - Price: ' . get_post_meta( $p-&gt;ID, 'price', true ) . '&lt;\/li&gt;';\n\t\t}\n\n\t\t$output .= '&lt;\/ul&gt;';\n\t}\n\nreturn $output ?? '&lt;strong&gt;Sorry. No posts matching your criteria!&lt;\/strong&gt;';<\/code><\/pre>\n<p>\u4e00\u9023\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u5b9a\u7fa9\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3059\u308b6\u3064\u306e\u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\u5c5e\u6027\u3092\u8a2d\u5b9a\u3057\u3001\u3053\u308c\u304c\u6700\u7d42\u7684\u306bWordPress\u306e <code>get_posts<\/code> \u95a2\u6570\u3078\u3068\u6e21\u3055\u308c\u307e\u3059\u3002<code>$custom_posts<\/code> \u304c\u7a7a\u3067\u306a\u3051\u308c\u3070\u3001<code>foreach<\/code> \u30b5\u30a4\u30af\u30eb\u306f\u9806\u5e8f\u4ed8\u3051\u306e\u306a\u3044\u30ea\u30b9\u30c8\u306eHTML\u3092\u751f\u6210\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3067\u3001\u3042\u306a\u305f\u306f\uff08\u305d\u3057\u3066\u3042\u306a\u305f\u306e\u30b5\u30a4\u30c8\u306e\u4ed6\u306e\u6295\u7a3f\u8005\u3082\uff09\u3001\u6b21\u306e\u3088\u3046\u306a\u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\u3092\u4f7f\u7528\u3057\u3066\u6295\u7a3f\u306e\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre>[kinsta_get_posts post_type=\"book\" book_category=\"sci-fi\" numberposts=\"4\" price_min=1 price_max=250]<\/pre>\n<p>\u3082\u3061\u308d\u3093\u3001\u5f15\u6570\u3092\u597d\u304d\u306a\u3088\u3046\u306b\u5909\u66f4\u3057\u3066\u3001\u30b5\u30a4\u30c8\u306e\u4efb\u610f\u306e\u6295\u7a3f\u307e\u305f\u306f\u30da\u30fc\u30b8\u3067\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<figure id=\"attachment_54811\" aria-describedby=\"caption-attachment-54811\" style=\"width: 1532px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-54811 size-full\" src=\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2019\/10\/get_posts-advanced-list-1.png\" alt=\"\u95a2\u6570\u3067\u69cb\u7bc9\u3057\u305f\u6295\u7a3f\u30ea\u30b9\u30c8\" width=\"1532\" height=\"1066\"><figcaption id=\"caption-attachment-54811\" class=\"wp-caption-text\">\u95a2\u6570\u3067\u69cb\u7bc9\u3057\u305f\u6295\u7a3f\u30ea\u30b9\u30c8<\/figcaption><\/figure>\n\n<h2>\u307e\u3068\u3081<\/h2>\n<p>WordPress\u306e<strong>get_posts<\/strong>\u306f\u3001\u958b\u767a\u8005\u304cWordPress\u30b5\u30a4\u30c8\u306e\u30d5\u30ed\u30f3\u30c8\u30a8\u30f3\u30c9\u306e\u3069\u3053\u306b\u3067\u3082\u6295\u7a3f\u306e\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u5f37\u529b\u306a\u6a5f\u80fd\u3067\u3059\u3002 <code>WP_Query<\/code> \u3092\u4f7f\u7528\u3057\u307e\u3059\u304c\u3001\u4f7f\u3044\u3084\u3059\u304f\u3001\u6295\u7a3f\u306e\u30ea\u30b9\u30c8\u3060\u3051\u304c\u5fc5\u8981\u306a\u5834\u5408\u306f <code>WP_Query<\/code> \u3088\u308a\u3082\u671b\u307e\u3057\u3044\u9078\u629e\u80a2\u3067\u3059\u3002\u6295\u7a3f\u3092<a href=\"https:\/\/codex.wordpress.org\/The_Loop\">\u30eb\u30fc\u30d7<\/a>\u3067\u8868\u793a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408\u306f <code>WP_Query<\/code> \u3092\u76f4\u63a5\u53c2\u7167\u3059\u308b\u3053\u3068\u3092\u304a\u52e7\u3081\u3057\u307e\u3059\u3002<\/p>\n<p>\u3068\u3044\u3046\u308f\u3051\u3067\u3001\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\u3057\u3001\u30b3\u30fc\u30c9\u3092\u30c6\u30b9\u30c8\u3057\u3001\u554f\u984c\u306a\u304f\u52d5\u4f5c\u3059\u308b\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u305f\u3089\uff08\u305d\u3053\u3067\u306f\u3058\u3081\u3066\uff09\u3001\u30e9\u30a4\u30d6\u74b0\u5883\u3078\u3068\u9069\u7528\u3057\u307e\u3057\u3087\u3046\uff08\u305f\u3060\u3057\u3001<a href=\"https:\/\/kinsta.com\/jp\/blog\/wordpress-backup-plugins\/\">\u6700\u521d\u306b\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u53d6\u308b<\/a>\u3053\u3068\u3082\u5fd8\u308c\u305a\u306b\uff09\u3002<\/p>\n<p>\u6700\u5f8c\u306b\u3001\u7686\u3055\u3093\u304b\u3089\u306e\u30b3\u30e1\u30f3\u30c8\u3092\u697d\u3057\u307f\u306b\u3057\u3066\u3044\u307e\u3059\u3002WordPress\u00a0 <code>get_posts<\/code> \u95a2\u6570\u306e\u3054\u4f7f\u7528\/\u6d3b\u7528\u4f8b\u306f\u3042\u308a\u307e\u3059\u304b\uff1f\u5b9f\u4f8b\u3092\u3054\u5171\u6709\u304f\u3060\u3055\u3044\u3002\u4ee5\u4e0b\u306e\u30b3\u30e1\u30f3\u30c8\u304b\u3089\u3069\u3046\u305e\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress\u306e get_posts \u306b\u3088\u308a\u3001  &#8230;<\/p>\n","protected":false},"author":36,"featured_media":25573,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kinsta_gated_content":false,"_kinsta_gated_content_redirect":"","footnotes":""},"tags":[45,157],"topic":[785,797],"class_list":["post-25569","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-webdev","tag-wp_query","topic-learn-php","topic-php-function"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v24.6 (Yoast SEO v24.6) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u300cWordPress get_posts\u300d\u3053\u306e\u4fbf\u5229\u306a PHP\u95a2\u6570\u3067\u6295\u7a3f\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5<\/title>\n<meta name=\"description\" content=\"\u6295\u7a3f\u3001\u56fa\u5b9a\u30da\u30fc\u30b8\u3001\u307e\u305f\u306f\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u306e\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\u3057\u305f\u3044\u3067\u3059\u304b\uff1f\u672c\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001WordPress\u306eget_posts\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u30ea\u30b9\u30c8\u306e\u4f5c\u308a\u65b9\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\uff01\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u300cWordPress get_posts\u300d\u3053\u306e\u4fbf\u5229\u306a PHP\u95a2\u6570\u3067\u6295\u7a3f\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5\" \/>\n<meta property=\"og:description\" content=\"\u6295\u7a3f\u3001\u56fa\u5b9a\u30da\u30fc\u30b8\u3001\u307e\u305f\u306f\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u306e\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\u3057\u305f\u3044\u3067\u3059\u304b\uff1f\u672c\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001WordPress\u306eget_posts\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u30ea\u30b9\u30c8\u306e\u4f5c\u308a\u65b9\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\uff01\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/\" \/>\n<meta property=\"og:site_name\" content=\"Kinsta\u00ae\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Kinsta-Japan-334616080691171\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-01-11T11:53:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-25T14:10:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2020\/01\/wordpress-get_posts.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1460\" \/>\n\t<meta property=\"og:image:height\" content=\"730\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Carlo Daniele\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:description\" content=\"\u6295\u7a3f\u3001\u56fa\u5b9a\u30da\u30fc\u30b8\u3001\u307e\u305f\u306f\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u306e\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\u3057\u305f\u3044\u3067\u3059\u304b\uff1f\u672c\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001WordPress\u306eget_posts\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u30ea\u30b9\u30c8\u306e\u4f5c\u308a\u65b9\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\uff01\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2020\/01\/wordpress-get_posts.png\" \/>\n<meta name=\"twitter:creator\" content=\"@carlodaniele\" \/>\n<meta name=\"twitter:site\" content=\"@Kinsta_JP\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"Carlo Daniele\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"6\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/\"},\"author\":{\"name\":\"Carlo Daniele\",\"@id\":\"https:\/\/kinsta.com\/jp\/#\/schema\/person\/962dde02ea6f5df089b5d8d0853bbc63\"},\"headline\":\"\u300cWordPress get_posts\u300d\u3053\u306e\u4fbf\u5229\u306a PHP\u95a2\u6570\u3067\u6295\u7a3f\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5\",\"datePublished\":\"2020-01-11T11:53:27+00:00\",\"dateModified\":\"2023-08-25T14:10:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/\"},\"wordCount\":183,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/kinsta.com\/jp\/#organization\"},\"image\":{\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2020\/01\/wordpress-get_posts.png\",\"keywords\":[\"webdev\",\"WP_Query\"],\"articleSection\":[\"WordPress\u958b\u767a\"],\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/\",\"url\":\"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/\",\"name\":\"\u300cWordPress get_posts\u300d\u3053\u306e\u4fbf\u5229\u306a PHP\u95a2\u6570\u3067\u6295\u7a3f\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5\",\"isPartOf\":{\"@id\":\"https:\/\/kinsta.com\/jp\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2020\/01\/wordpress-get_posts.png\",\"datePublished\":\"2020-01-11T11:53:27+00:00\",\"dateModified\":\"2023-08-25T14:10:31+00:00\",\"description\":\"\u6295\u7a3f\u3001\u56fa\u5b9a\u30da\u30fc\u30b8\u3001\u307e\u305f\u306f\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u306e\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\u3057\u305f\u3044\u3067\u3059\u304b\uff1f\u672c\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001WordPress\u306eget_posts\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u30ea\u30b9\u30c8\u306e\u4f5c\u308a\u65b9\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\uff01\",\"breadcrumb\":{\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/#primaryimage\",\"url\":\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2020\/01\/wordpress-get_posts.png\",\"contentUrl\":\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2020\/01\/wordpress-get_posts.png\",\"width\":1460,\"height\":730,\"caption\":\"\u300cWordPress get_posts\u300d\u3053\u306e\u4fbf\u5229\u306a PHP\u95a2\u6570\u3067\u6295\u7a3f\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/kinsta.com\/jp\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PHP\u3092\u5b66\u3076\",\"item\":\"https:\/\/kinsta.com\/jp\/topics\/learn-php\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"\u300cWordPress get_posts\u300d\u3053\u306e\u4fbf\u5229\u306a PHP\u95a2\u6570\u3067\u6295\u7a3f\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/kinsta.com\/jp\/#website\",\"url\":\"https:\/\/kinsta.com\/jp\/\",\"name\":\"Kinsta\u00ae\",\"description\":\"\u9ad8\u901f\u304b\u3064\u5805\u7262\u306a\u30d7\u30ec\u30df\u30a2\u30e0\u30b5\u30fc\u30d0\u30fc\u30b5\u30fc\u30d3\u30b9\",\"publisher\":{\"@id\":\"https:\/\/kinsta.com\/jp\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/kinsta.com\/jp\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ja\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/kinsta.com\/jp\/#organization\",\"name\":\"Kinsta\",\"url\":\"https:\/\/kinsta.com\/jp\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/kinsta.com\/jp\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2023\/12\/kinsta-logo.jpeg\",\"contentUrl\":\"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2023\/12\/kinsta-logo.jpeg\",\"width\":500,\"height\":500,\"caption\":\"Kinsta\"},\"image\":{\"@id\":\"https:\/\/kinsta.com\/jp\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Kinsta-Japan-334616080691171\/\",\"https:\/\/x.com\/Kinsta_JP\",\"https:\/\/www.instagram.com\/kinstahosting\/\",\"https:\/\/www.linkedin.com\/company\/kinsta\/\",\"https:\/\/www.pinterest.com\/kinstahosting\/\",\"https:\/\/www.youtube.com\/c\/Kinsta\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/kinsta.com\/jp\/#\/schema\/person\/962dde02ea6f5df089b5d8d0853bbc63\",\"name\":\"Carlo Daniele\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/kinsta.com\/jp\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/429e5568f88110fd9a409b84cb22197e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/429e5568f88110fd9a409b84cb22197e?s=96&d=mm&r=g\",\"caption\":\"Carlo Daniele\"},\"description\":\"Carlo is a passionate lover of webdesign and front-end development. He has been playing with WordPress for more than 20 years, also in collaboration with Italian and European universities and educational institutions. He has written hundreds of articles and guides about WordPress, published both on Italian and international websites, as well as on printed magazines. You can find him on LinkedIn.\",\"sameAs\":[\"https:\/\/frammentidicodice.com\/\",\"https:\/\/x.com\/carlodaniele\"],\"url\":\"https:\/\/kinsta.com\/jp\/blog\/author\/carlodaniele\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u300cWordPress get_posts\u300d\u3053\u306e\u4fbf\u5229\u306a PHP\u95a2\u6570\u3067\u6295\u7a3f\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5","description":"\u6295\u7a3f\u3001\u56fa\u5b9a\u30da\u30fc\u30b8\u3001\u307e\u305f\u306f\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u306e\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\u3057\u305f\u3044\u3067\u3059\u304b\uff1f\u672c\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001WordPress\u306eget_posts\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u30ea\u30b9\u30c8\u306e\u4f5c\u308a\u65b9\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\uff01","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/","og_locale":"ja_JP","og_type":"article","og_title":"\u300cWordPress get_posts\u300d\u3053\u306e\u4fbf\u5229\u306a PHP\u95a2\u6570\u3067\u6295\u7a3f\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5","og_description":"\u6295\u7a3f\u3001\u56fa\u5b9a\u30da\u30fc\u30b8\u3001\u307e\u305f\u306f\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u306e\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\u3057\u305f\u3044\u3067\u3059\u304b\uff1f\u672c\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001WordPress\u306eget_posts\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u30ea\u30b9\u30c8\u306e\u4f5c\u308a\u65b9\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\uff01","og_url":"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/","og_site_name":"Kinsta\u00ae","article_publisher":"https:\/\/www.facebook.com\/Kinsta-Japan-334616080691171\/","article_published_time":"2020-01-11T11:53:27+00:00","article_modified_time":"2023-08-25T14:10:31+00:00","og_image":[{"width":1460,"height":730,"url":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2020\/01\/wordpress-get_posts.png","type":"image\/png"}],"author":"Carlo Daniele","twitter_card":"summary_large_image","twitter_description":"\u6295\u7a3f\u3001\u56fa\u5b9a\u30da\u30fc\u30b8\u3001\u307e\u305f\u306f\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u306e\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\u3057\u305f\u3044\u3067\u3059\u304b\uff1f\u672c\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001WordPress\u306eget_posts\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u30ea\u30b9\u30c8\u306e\u4f5c\u308a\u65b9\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\uff01","twitter_image":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2020\/01\/wordpress-get_posts.png","twitter_creator":"@carlodaniele","twitter_site":"@Kinsta_JP","twitter_misc":{"\u57f7\u7b46\u8005":"Carlo Daniele","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"6\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/#article","isPartOf":{"@id":"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/"},"author":{"name":"Carlo Daniele","@id":"https:\/\/kinsta.com\/jp\/#\/schema\/person\/962dde02ea6f5df089b5d8d0853bbc63"},"headline":"\u300cWordPress get_posts\u300d\u3053\u306e\u4fbf\u5229\u306a PHP\u95a2\u6570\u3067\u6295\u7a3f\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5","datePublished":"2020-01-11T11:53:27+00:00","dateModified":"2023-08-25T14:10:31+00:00","mainEntityOfPage":{"@id":"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/"},"wordCount":183,"commentCount":0,"publisher":{"@id":"https:\/\/kinsta.com\/jp\/#organization"},"image":{"@id":"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/#primaryimage"},"thumbnailUrl":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2020\/01\/wordpress-get_posts.png","keywords":["webdev","WP_Query"],"articleSection":["WordPress\u958b\u767a"],"inLanguage":"ja","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/","url":"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/","name":"\u300cWordPress get_posts\u300d\u3053\u306e\u4fbf\u5229\u306a PHP\u95a2\u6570\u3067\u6295\u7a3f\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5","isPartOf":{"@id":"https:\/\/kinsta.com\/jp\/#website"},"primaryImageOfPage":{"@id":"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/#primaryimage"},"image":{"@id":"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/#primaryimage"},"thumbnailUrl":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2020\/01\/wordpress-get_posts.png","datePublished":"2020-01-11T11:53:27+00:00","dateModified":"2023-08-25T14:10:31+00:00","description":"\u6295\u7a3f\u3001\u56fa\u5b9a\u30da\u30fc\u30b8\u3001\u307e\u305f\u306f\u30ab\u30b9\u30bf\u30e0\u6295\u7a3f\u30bf\u30a4\u30d7\u306e\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\u3057\u305f\u3044\u3067\u3059\u304b\uff1f\u672c\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001WordPress\u306eget_posts\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u30ea\u30b9\u30c8\u306e\u4f5c\u308a\u65b9\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\uff01","breadcrumb":{"@id":"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/"]}]},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/#primaryimage","url":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2020\/01\/wordpress-get_posts.png","contentUrl":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2020\/01\/wordpress-get_posts.png","width":1460,"height":730,"caption":"\u300cWordPress get_posts\u300d\u3053\u306e\u4fbf\u5229\u306a PHP\u95a2\u6570\u3067\u6295\u7a3f\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5"},{"@type":"BreadcrumbList","@id":"https:\/\/kinsta.com\/jp\/blog\/wordpress-get_posts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kinsta.com\/jp\/"},{"@type":"ListItem","position":2,"name":"PHP\u3092\u5b66\u3076","item":"https:\/\/kinsta.com\/jp\/topics\/learn-php\/"},{"@type":"ListItem","position":3,"name":"\u300cWordPress get_posts\u300d\u3053\u306e\u4fbf\u5229\u306a PHP\u95a2\u6570\u3067\u6295\u7a3f\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u65b9\u6cd5"}]},{"@type":"WebSite","@id":"https:\/\/kinsta.com\/jp\/#website","url":"https:\/\/kinsta.com\/jp\/","name":"Kinsta\u00ae","description":"\u9ad8\u901f\u304b\u3064\u5805\u7262\u306a\u30d7\u30ec\u30df\u30a2\u30e0\u30b5\u30fc\u30d0\u30fc\u30b5\u30fc\u30d3\u30b9","publisher":{"@id":"https:\/\/kinsta.com\/jp\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kinsta.com\/jp\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ja"},{"@type":"Organization","@id":"https:\/\/kinsta.com\/jp\/#organization","name":"Kinsta","url":"https:\/\/kinsta.com\/jp\/","logo":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/kinsta.com\/jp\/#\/schema\/logo\/image\/","url":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2023\/12\/kinsta-logo.jpeg","contentUrl":"https:\/\/kinsta.com\/jp\/wp-content\/uploads\/sites\/6\/2023\/12\/kinsta-logo.jpeg","width":500,"height":500,"caption":"Kinsta"},"image":{"@id":"https:\/\/kinsta.com\/jp\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Kinsta-Japan-334616080691171\/","https:\/\/x.com\/Kinsta_JP","https:\/\/www.instagram.com\/kinstahosting\/","https:\/\/www.linkedin.com\/company\/kinsta\/","https:\/\/www.pinterest.com\/kinstahosting\/","https:\/\/www.youtube.com\/c\/Kinsta"]},{"@type":"Person","@id":"https:\/\/kinsta.com\/jp\/#\/schema\/person\/962dde02ea6f5df089b5d8d0853bbc63","name":"Carlo Daniele","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/kinsta.com\/jp\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/429e5568f88110fd9a409b84cb22197e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/429e5568f88110fd9a409b84cb22197e?s=96&d=mm&r=g","caption":"Carlo Daniele"},"description":"Carlo is a passionate lover of webdesign and front-end development. He has been playing with WordPress for more than 20 years, also in collaboration with Italian and European universities and educational institutions. He has written hundreds of articles and guides about WordPress, published both on Italian and international websites, as well as on printed magazines. You can find him on LinkedIn.","sameAs":["https:\/\/frammentidicodice.com\/","https:\/\/x.com\/carlodaniele"],"url":"https:\/\/kinsta.com\/jp\/blog\/author\/carlodaniele\/"}]}},"acf":[],"_links":{"self":[{"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/posts\/25569","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/users\/36"}],"replies":[{"embeddable":true,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/comments?post=25569"}],"version-history":[{"count":6,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/posts\/25569\/revisions"}],"predecessor-version":[{"id":31327,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/posts\/25569\/revisions\/31327"}],"alternate":[{"embeddable":true,"hreflang":"en","title":"English","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/25569\/translations\/en"},{"embeddable":true,"hreflang":"pt","title":"Portuguese","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/25569\/translations\/pt"},{"embeddable":true,"hreflang":"es","title":"Spanish","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/25569\/translations\/es"},{"embeddable":true,"hreflang":"fr","title":"French","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/25569\/translations\/fr"},{"embeddable":true,"hreflang":"nl","title":"Dutch","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/25569\/translations\/nl"},{"embeddable":true,"hreflang":"it","title":"Italian","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/25569\/translations\/it"},{"embeddable":true,"hreflang":"de","title":"German","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/25569\/translations\/de"},{"embeddable":true,"hreflang":"sv","title":"Swedish","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/25569\/translations\/se"},{"embeddable":true,"hreflang":"ja","title":"Japanese","href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/25569\/translations\/jp"},{"href":"https:\/\/kinsta.com\/jp\/wp-json\/kinsta\/v1\/posts\/25569\/tree"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/media\/25573"}],"wp:attachment":[{"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/media?parent=25569"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/tags?post=25569"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/kinsta.com\/jp\/wp-json\/wp\/v2\/topic?post=25569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}