{"id":638,"date":"2020-12-02T00:44:39","date_gmt":"2020-12-01T15:44:39","guid":{"rendered":"https:\/\/blog.srytk.com\/aquei\/?p=638"},"modified":"2020-12-02T00:44:41","modified_gmt":"2020-12-01T15:44:41","slug":"wordpress%e3%81%ae%e5%90%8c%e3%82%ab%e3%83%86%e3%82%b4%e3%83%aa%e9%9a%a3%e6%8e%a5%e8%a8%98%e4%ba%8b%e3%82%92link%e8%a6%81%e7%b4%a0%e3%81%a7%e5%87%ba%e3%81%99%e3%81%ae%e3%81%8c%e3%83%80%e3%83%ab","status":"publish","type":"post","link":"https:\/\/blog.srytk.com\/aquei\/638.html","title":{"rendered":"WordPress\u306e\u540c\u30ab\u30c6\u30b4\u30ea\u96a3\u63a5\u8a18\u4e8b\u3092LINK\u8981\u7d20\u3067\u51fa\u3059\u306e\u304c\u30c0\u30eb\u3044"},"content":{"rendered":"\n<p>WordPress\u3067\u306fhead\u8981\u7d20\u306b\u96a3\u63a5\u3059\u308b\u8a18\u4e8b\u306e<code>&lt;link rel=\"next\"><\/code>\u3084<code>&lt;link rel=\"prev\"><\/code>\u304c\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u51fa\u529b\u3055\u308c\u308b\uff08\u307e\u3068\u3082\u306a\u30c6\u30fc\u30de\u306a\u3089)\u3002\u3053\u308c\u3089\u306eLINK\u8981\u7d20\u306f\u96a3\u63a5\u3059\u308b\u524d\u5f8c\u306e\u8a18\u4e8b\u3084\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u3055\u308c\u305f\u8a18\u4e8b\u3092\u53c2\u7167\u3055\u305b\u308b\u305f\u3081\u306b\u5b58\u5728\u3059\u308b\u306e\u3060\u304c\u3001\u3053\u306eLINK\u8981\u7d20\u3092\u540c\u3058\u30ab\u30c6\u30b4\u30ea\u306b\u9650\u5b9a\u3055\u305b\u308b\u3053\u3068\u304c\u51fa\u6765\u306a\u3044\u3002\u4e00\u5fdc\u3001<a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/adjacent_posts_rel_link\/\">\u8981\u7d20\u3092\u51fa\u529b\u3059\u308b\u95a2\u6570\u306b\u5f15\u6570\u3092\u6e21\u305b\u3070\u3067\u304d\u308b<\/a>\u306e\u3060\u304c\u3001<a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/adjacent_posts_rel_link_wp_head\/\">\u305d\u306e\u95a2\u6570\u3092\u547c\u3073\u51fa\u3059\u30b3\u30fc\u30c9\u304c\u30cf\u30fc\u30c9\u30b3\u30fc\u30c9\u3055\u308c\u3066\u3044\u308b<\/a>\u306e\u3067\u7d50\u5c40\u306f\u30de\u30cb\u30e5\u30a2\u30eb\u3067\u5bfe\u5fdc\u3055\u305b\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3002<\/p>\n\n\n\n<p>\u52d5\u4f5c\u3068\u3057\u3066\u306f\u65e2\u306b\u5b58\u5728\u3059\u308b\u95a2\u6570\u3092\u5f15\u6570\u3092\u8ffd\u52a0\u3057\u3066\u547c\u3073\u51fa\u3059\u3060\u3051\u3001\u3068\u7c21\u5358\u3002\u306a\u306e\u3067\u30d7\u30e9\u30b0\u30a4\u30f3\u304c\u5b58\u5728\u3057\u3066\u3044\u305d\u3046\u3060\u3068\u601d\u3044\u691c\u7d22\u3057\u3066\u307f\u305f\u304c\u3001<a href=\"https:\/\/ja.wordpress.org\/plugins\/search\/adjacent\/\">adjacent<\/a>\u3068\u304bsame category link\u3068\u304b\u3067\u691c\u7d22\u3057\u3066\u3082\u305d\u308c\u3063\u307d\u3044\u3082\u306e\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u3002\u7d76\u5bfe\u306b\u3042\u308a\u305d\u3046\u3060\u304c\u3001\u6b63\u3057\u3044\u691c\u7d22\u30ef\u30fc\u30c9\u304c\u308f\u304b\u3089\u306a\u3044\u304b\u3089\u56f0\u3063\u305f\u3002\u305d\u308c\u3067\u7d50\u5c40\u3001\u81ea\u5206\u3067\u66f8\u3044\u305f\u3002\u60b2\u3057\u3044\u3002\u3074\u3048\u3093&#x1f97a;\u3002\u3044\u3084\u3001\u4f7f\u3044\u65b9\u308f\u304b\u3089\u3093\u308f\u3002<\/p>\n\n\n\n<pre><code class=\"php\">&lt;?php\n\/*\nPlugin Name: Same category adjacent posts link in head\nDescription: WordPress\u306e\u5358\u4e00\u8a18\u4e8b\u30d8\u30c3\u30c0\u5185\u306e\u96a3\u63a5\u8a18\u4e8bLink\u3092\u540c\u3058\u30ab\u30c6\u30b4\u30ea\u306b\u9650\u5b9a\u3055\u305b\u308bplugin\nVersion: 1.0.0\nAuther: Aquei\nAuthor URI: https:\/\/blog.srytk.com\/aquei\/\nLicense: CC0\n *\/\n\nnamespace wordpress\\plugin\\samecategory;\n\nfunction samecat(){\n\tif(! is_single() || is_attachment() || has_action(&apos;wp_head&apos;, &apos;adjacent_posts_rel_link_wp_head&apos;) === False){\n\t\treturn;\n\t}\n\n\t\/\/\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30d5\u30c3\u30af\u3092\u524a\u9664\n\t$result = remove_action(&apos;wp_head&apos;, &apos;adjacent_posts_rel_link_wp_head&apos;, 10);\n\n\t\/\/\u5909\u308f\u308a\u306e\u30d5\u30c3\u30af\u3092\u8ffd\u52a0\n\tif($result){\n\t\tadd_action(&apos;wp_head&apos;, __NAMESPACE__ . &apos;\\\\samecat_cb&apos;);\n\t}\n}\n\nfunction samecat_cb(){\n\tadjacent_posts_rel_link(&apos;%title&apos;, True);\n}\t\n\nadd_action(&apos;wp&apos;, __NAMESPACE__ . &apos;\\\\samecat&apos;);<\/code><\/pre>\n\n\n\n<p>\u3068\u308a\u3042\u3048\u305a\u671f\u5f85\u901a\u308a\u306e\u52d5\u4f5c\u306b\u306a\u3063\u305f\u3002\u6700\u521d\u3001<q cite=\"https:\/\/wpdocs.osdn.jp\/%E6%9D%A1%E4%BB%B6%E5%88%86%E5%B2%90%E3%82%BF%E3%82%B0\">\u6761\u4ef6\u5206\u5c90\u30bf\u30b0\u304c\u4f7f\u3048\u308b\u306e\u306f WordPress \u306e <em>posts_selection<\/em> <a href=\"https:\/\/wpdocs.osdn.jp\/%E3%83%97%E3%83%A9%E3%82%B0%E3%82%A4%E3%83%B3_API\/%E3%82%A2%E3%82%AF%E3%82%B7%E3%83%A7%E3%83%B3%E3%83%95%E3%83%83%E3%82%AF%E4%B8%80%E8%A6%A7#.E4.B8.80.E8.88.AC.E7.9A.84.E3.83.AA.E3.82.AF.E3.82.A8.E3.82.B9.E3.83.88.E4.B8.AD.E3.81.AB.E5.AE.9F.E8.A1.8C.E3.81.95.E3.82.8C.E3.82.8B.E3.82.A2.E3.82.AF.E3.82.B7.E3.83.A7.E3.83.B3\">\u30a2\u30af\u30b7\u30e7\u30f3\u30d5\u30c3\u30af<\/a>\u306e\u5f8c\u306e\u307f<\/q>\u3060\u3068\u3057\u3089\u306a\u304f\u3066\u3061\u3087\u3063\u3068\u8a70\u307e\u3063\u305f\u3002\u3074\u3048\u3093&#x1f97a;\u3002\u4e8c\u56de\u76ee\uff01\uff01\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress\u3067\u306fhead\u8981\u7d20\u306b\u96a3\u63a5\u3059\u308b\u8a18\u4e8b\u306e&lt;link rel=&#8221;next&#8221;>\u3084&lt;link rel=&#8221;prev&#8221;>\u304c\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u51fa\u529b\u3055\u308c\u308b\uff08\u307e\u3068\u3082\u306a\u30c6\u30fc\u30de\u306a\u3089)\u3002\u3053\u308c\u3089\u306eLINK\u8981\u7d20\u306f\u96a3\u63a5\u3059\u308b\u524d\u5f8c\u306e\u8a18\u4e8b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"local","activitypub_max_image_attachments":5,"footnotes":""},"categories":[2],"tags":[3],"class_list":["post-638","post","type-post","status-publish","format-standard","hentry","category-tech","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/posts\/638","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/comments?post=638"}],"version-history":[{"count":1,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/posts\/638\/revisions"}],"predecessor-version":[{"id":639,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/posts\/638\/revisions\/639"}],"wp:attachment":[{"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/media?parent=638"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/categories?post=638"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.srytk.com\/aquei\/wp-json\/wp\/v2\/tags?post=638"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}