{"id":6825,"date":"2020-04-10T15:00:54","date_gmt":"2020-04-10T06:00:54","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=6825"},"modified":"2024-02-18T20:12:28","modified_gmt":"2024-02-18T11:12:28","slug":"%e3%80%90wordpress%e3%80%91%e3%83%97%e3%83%a9%e3%82%b0%e3%82%a4%e3%83%b3%e3%81%aa%e3%81%97%e3%81%a7twitter%e3%81%ab%e8%87%aa%e5%8b%95%e6%8a%95%e7%a8%bf%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=6825","title":{"rendered":"\u3010wordpress\u3011\u30d7\u30e9\u30b0\u30a4\u30f3\u306a\u3057\u3067Twitter\u306b\u81ea\u52d5\u6295\u7a3f\u3059\u308b"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u4ee5\u524d\u3053\u306e\u30d6\u30ed\u30b0\u3067\u306f<strong>\u8a18\u4e8b\u3092\u516c\u958b\u3059\u308b\u3068\u304d\u3001\u4ee5\u4e0b\u306e\u30c4\u30a4\u30c3\u30bf\u30fc\u3067\u304a\u77e5\u3089\u305b\u3057\u3066\u3044\u307e\u3057\u305f\u3002<\/strong><\/p>\n<p><a href=\"https:\/\/twitter.com\/SukohiKuhoh\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6852\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/04\/twitter_home.png\" alt=\"\" width=\"200\" height=\"128\" \/><\/a><br \/>\n<a href=\"https:\/\/twitter.com\/SukohiKuhoh\" target=\"_blank\" rel=\"noopener noreferrer\">\u3010\u304a\u77e5\u3089\u305b\u3092\u3057\u3066\u3044\u305f\u30c4\u30a4\u30c3\u30bf\u30fc\u3011<\/a><\/p>\n<p>\u5b9f\u306f\u5f53\u6642\u3001\u3042\u308b\u30b5\u30fc\u30d3\u30b9\u3067\u81ea\u52d5\u6295\u7a3f\u3057\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001<code>Twitter<\/code>\u306e\u4ed5\u69d8\u304c\u5909\u66f4\u306b\u306a\u3063\u305f\u5f71\u97ff\u3067\u6b8b\u5ff5\u306a\u304c\u3089\u5229\u7528\u3067\u304d\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u2026\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u9577\u3089\u304f<code>Twitter<\/code>\u3068\u306e\u9023\u643a\u306f\u3057\u3066\u306a\u304b\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u305b\u3063\u304b\u304f\u8a18\u4e8b\u3092\u66f8\u304f\u304b\u3089\u306b\u306f\u591a\u304f\u306e\u4eba\u306b\u8aad\u3093\u3067\u3082\u3089\u3044\u305f\u3068\u601d\u3044<strong>\u3053\u306e\u5ea6\u3001<\/strong><strong>\u518d\u958b\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/strong><\/p>\n<p>\u305d\u306e\u305f\u3081\u3001<code>wordpress<\/code>\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u8a66\u3057\u305f\u306e\u3067\u3059\u304c\u3001\u306a\u305c\u304b\u4e0a\u624b\u304f\u3044\u304b\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u3082\u3046\u3053\u306e\u969b\u3001<strong>\u81ea\u52d5\u30c4\u30a4\u30fc\u30c8\u6a5f\u80fd\u3092\u81ea\u524d\u3067\u4f5c\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/strong><\/p>\n<p>\u305d\u3053\u3067\u2757<\/p>\n<p>\u4eca\u56de\u306f\u30d7\u30e9\u30b0\u30a4\u30f3\u306a\u3057\u3067<code>wordpress<\/code>\u304b\u3089<code>Twitter<\/code>\u306b\u81ea\u52d5\u6295\u7a3f\u3059\u308b\u6a5f\u80fd\u306e\u4f5c\u308a\u65b9\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u306e\u304a\u5f79\u306b\u7acb\u3066\u308b\u3068\u5b09\u3057\u3044\u3067\u3059\ud83d\ude0a\u2728<\/p>\n<p><strong>\u3010\u8ffd\u8a18\uff1a2023.9.20\u3011<\/strong><br \/>\n\u30a4\u30fc\u30ed\u30f3\u30fb\u30de\u30b9\u30af\u3055\u3093\u304c<code>Twitter<\/code>\u3092<code>X<\/code>\u306b\u5909\u66f4\u3059\u308b\u306a\u3069\u5927\u304d\u304f\u6539\u9769\u3092\u884c\u3063\u305f\u7d50\u679c\u3001<code>Twitter<\/code>\u306e<code>API<\/code>\u3082\u30ab\u30aa\u30b9\u3068\u306a\u3063\u3066\u3057\u307e\u3044\u3001\u79c1\u81ea\u8eab\u3053\u306e\u65b9\u6cd5\u3067\u306f\u3046\u307e\u304f\u3044\u304b\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002\u304a\u305d\u3089\u304f\u6599\u91d1\u3092\u6255\u3046\u65b9\u6cd5\u304c\u30d9\u30b9\u30c8\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3405 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_18.png\" alt=\"\" width=\"310\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_18.png 310w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_18-291x300.png 291w\" sizes=\"auto, (max-width: 310px) 100vw, 310px\" \/><\/p>\n<p style=\"text-align: center;\">\u300c\u8a66\u3057\u306b\u30c4\u30a4\u30fc\u30c8\u3057\u305f\u3089\u300c\u30a4\u30a4\u30cd\u300d\u3092\u3044\u305f\u3060\u3044\u3066\u3057\u307e\u3044\u3001<br \/>\n\u8abf\u5b50\u306b\u306e\u3063\u3066\u3059\u3050\u8a18\u4e8b\u3092\u66f8\u304d\u307e\u3057\u305f\ud83d\ude06\u300d<\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> WordPress 5.4<\/p>\n<h1>\u524d\u63d0\u3068\u3057\u3066<\/h1>\n<p>\u81ea\u52d5\u6295\u7a3f\u306b\u5fc5\u8981\u306a<code>Twitter API<\/code>\u306e\u30c8\u30fc\u30af\u30f3\u3092\u300c<a href=\"https:\/\/blog.capilano-fw.com\/?p=5226#api_key_n_access_token\" target=\"_blank\" rel=\"noopener noreferrer\">\u30c4\u30a4\u30c3\u30bf\u30fc\u3067API\u30ad\u30fc\u3068\u30a2\u30af\u30bb\u30b9\u30fb\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97\u3059\u308b<\/a>\u300d\u3092\u53c2\u8003\u306b\u3057\u3066\u7528\u610f\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u307e\u305f\u3001\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97\u3057\u305f\u3089\u3001\u3069\u3053\u304b\u3089\u3067\u3082\u547c\u3073\u51fa\u305b\u308b\u3088\u3046\u306b<code>wp-config.php<\/code>\u306b\u6b21\u306e\u3088\u3046\u66f8\u304d\u8fbc\u3093\u3067\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong><code>\/wp-config.php<\/code><\/strong><\/p>\n<pre><strong>\/\/ Twitter API\r\ndefine('TWITTER_CONSUMER_KEY', '\uff08\u3053\u3053\u306bAPI key\uff09');\r\ndefine('TWITTER_CONSUMER_SECRET', '\uff08\u3053\u3053\u306bAPI secret key\uff09');\r\ndefine('TWITTER_ACCESS_TOKEN', '\uff08\u3053\u3053\u306bAccess token\uff09');\r\ndefine('TWITTER_ACCESS_SECRET', '\uff08\u3053\u3053\u306bAccess token secret\uff09');<\/strong><\/pre>\n<h1>composer\u3067\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h1>\n<p>\u4eca\u56de\u306f<code>composer<\/code>\u3092\u4f7f\u3063\u3066\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u306e\u3067\u3001\u307e\u305a<code>wordpress<\/code>\u306e\u30d5\u30a9\u30eb\u30c0\u5185\u3067\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066<code>composer.json<\/code>\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>composer init<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u3044\u304f\u3064\u304b\u8cea\u554f\u3092\u805e\u304b\u308c\u307e\u3059\u304c\u3001\u9069\u5f53\u306b<code>Enter<\/code>\u3084<code>n<\/code>\u306a\u3069\u3067\u3082OK\u3067\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001<code>composer.json<\/code>\u304c\u4f5c\u6210\u3055\u308c\u305f\u3089\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4fdd\u5b58\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>composer require abraham\/twitteroauth<\/strong><\/pre>\n<p>\u3053\u308c\u3067\u300c<strong>\/vendor<\/strong>\u300d\u30d5\u30a9\u30eb\u30c0\u306b\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<h1>\u5b50\u30c6\u30fc\u30de\u3092\u3064\u304f\u308b<\/h1>\n<p><code>wordpress<\/code>\u3067\u306f\u3088\u304f\u77e5\u3089\u308c\u305f\u30c6\u30af\u30cb\u30c3\u30af\u3067\u3059\u304c\u3001\u30c6\u30fc\u30de\u672c\u4f53\u3092\u6539\u9020\u3057\u3066\u3057\u307e\u3046\u3068\u3001\u305d\u306e\u5f8c\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u304c\u3042\u308b\u3068\u5909\u66f4\u90e8\u5206\u3092\u5168\u3066\u5931\u3063\u3066\u3057\u307e\u3046\u3053\u3068\u306b\u306a\u308b\u305f\u3081\u3001<strong>\u300c\u5b50\u30c6\u30fc\u30de\u300d\u3068\u3044\u3046\u90e8\u5206\u7684\u306b\u6539\u5909\u3055\u308c\u306a\u3044\u30d5\u30a1\u30a4\u30eb\u3092\u3064\u304f\u308a\u307e\u3059\u3002<\/strong><\/p>\n<h2>\u5b50\u30c6\u30fc\u30de\u7528\u306e\u30d5\u30a9\u30eb\u30c0\u3092\u3064\u304f\u308b<\/h2>\n<p>\u300c<strong>\/wp-content\/themes<\/strong>\u300d\u30d5\u30a9\u30eb\u30c0\u5185\u306b\u5b50\u30c6\u30fc\u30de\u306e\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u308a\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u306f\u3001<code>twentyseventeen<\/code>\u306e\u5b50\u30c6\u30fc\u30de\u3092\u4f5c\u308b\u306e\u3067\u3001<code>twentyseventeen-child<\/code>\u3068\u3044\u3046\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u308a\u307e\u3059\u304c\u3001\u540d\u524d\u306f\u304a\u597d\u307f\u3067\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6833\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/04\/wordpress_twitter_2.png\" alt=\"\" width=\"576\" height=\"141\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/04\/wordpress_twitter_2.png 576w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/04\/wordpress_twitter_2-300x73.png 300w\" sizes=\"auto, (max-width: 576px) 100vw, 576px\" \/><\/p>\n<h2>\u5fc5\u8981\u306a\u30d5\u30a1\u30a4\u30eb\u3092\u7528\u610f\u3059\u308b<\/h2>\n<p>\u6b21\u306b\u4f5c\u6210\u3057\u305f\u5b50\u30c6\u30fc\u30de\u306e\u30d5\u30a9\u30eb\u30c0\u306b\u79fb\u52d5\u3057\u3001\u4ee5\u4e0b\uff12\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li>functions.php<\/li>\n<li>style.css<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6834\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/04\/wordpress_twitter_3.png\" alt=\"\" width=\"462\" height=\"130\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/04\/wordpress_twitter_3.png 462w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/04\/wordpress_twitter_3-300x84.png 300w\" sizes=\"auto, (max-width: 462px) 100vw, 462px\" \/><\/p>\n<p>\u305d\u3057\u3066\u3001\u305d\u308c\u305e\u308c\u4e2d\u8eab\u3092\u6b21\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong><code>\/wp-content\/themes\/twentyseventeen-child\/functions.php<\/code><\/strong><\/p>\n<pre>&lt;?php\r\n\r\n<strong>add_action('wp_enqueue_scripts', function(){<\/strong>\r\n\r\n<strong>    wp_enqueue_style('parent-style', get_template_directory_uri() .'\/style.css');<\/strong>\r\n\r\n<strong>});<\/strong><\/pre>\n<p><strong><code>\/wp-content\/themes\/twentyseventeen-child\/style.css<\/code><\/strong><\/p>\n<pre>\/*\r\nTheme Name: Twenty Seventeen Child\r\nTheme URL: http:\/\/example.com\r\nDescription: Twenty Seventeen Child\r\nTheme Author: Your Name\r\nAuthor URL: http:\/\/example.com\r\nTemplate: twentyseventeen\r\nVersion: 1.0.0\r\nText Domain: twentyseventeen-child\r\n*\/<\/pre>\n<p>\u305d\u3057\u3066\u3001<code>wordpress<\/code>\u306b\u30ed\u30b0\u30a4\u30f3\u3057\u3001\u30da\u30fc\u30b8\u5de6\u5074\u306b\u3042\u308b\u30e1\u30cb\u30e5\u30fc\u304b\u3089\u300c<strong>\u5916\u89b3<\/strong>\u300d\u3092\u30af\u30ea\u30c3\u30af\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6835\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/04\/wordpress_twitter_4.png\" alt=\"\" width=\"160\" height=\"379\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/04\/wordpress_twitter_4.png 160w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/04\/wordpress_twitter_4-127x300.png 127w\" sizes=\"auto, (max-width: 160px) 100vw, 160px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u30c6\u30fc\u30de\u4e00\u89a7\u306e\u4e2d\u306b\u5148\u307b\u3069\u4f5c\u3063\u305f\u5b50\u30c6\u30fc\u30de\u304c\u3042\u308b\u306e\u3067\u30de\u30a6\u30b9\u3092\u5408\u308f\u305b\u3066\u300c<strong>\u6709\u52b9\u5316<\/strong>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6836\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/04\/wordpress_twitter_5.png\" alt=\"\" width=\"640\" height=\"386\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/04\/wordpress_twitter_5.png 640w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/04\/wordpress_twitter_5-300x181.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>\u3053\u308c\u3067\u3001\u5b50\u30c6\u30fc\u30de\u306e\u90e8\u5206\u306f\u5b8c\u4e86\u3067\u3059\u3002<\/p>\n<h1>Twitter\u3092\u81ea\u52d5\u9001\u4fe1\u3059\u308b\u90e8\u5206\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u8a18\u4e8b\u304c\u6295\u7a3f\u3055\u308c\u305f\u3089<code>Twitter<\/code>\u306b\u81ea\u52d5\u6295\u7a3f\u3059\u308b\u90e8\u5206\u3092\u4f5c\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u6295\u7a3f\u5185\u5bb9\u306e\u30a4\u30e1\u30fc\u30b8\u306f\u3001\u3053\u3093\u306a\u30ab\u30f3\u30b8\u3067\u3059\u3002<\/p>\n<pre>\u300c\u25cf\u25cf\u25cf\u25cf\u25cf\u25cf\u300d\u3068\u3044\u3046\u8a18\u4e8b\u3092\u516c\u958b\u3057\u307e\u3057\u305f\uff01 \ud83d\udc48 \u8a18\u4e8b\u30bf\u30a4\u30c8\u30eb\r\n\r\nhttp:\/\/****\/**** \ud83d\udc48 URL\r\n\r\n#Laravel #Vue.js \ud83d\udc48 \u30ab\u30c6\u30b4\u30ea\u540d\u304c\u30cf\u30c3\u30b7\u30e5\u30bf\u30b0<\/pre>\n<p>\u3067\u306f\u5b9f\u969b\u306e\u30b3\u30fc\u30c9\u3067\u3059\u3002<\/p>\n<p><strong><code>\/wp-content\/themes\/twentyseventeen-child\/functions.php<\/code><\/strong><\/p>\n<pre>add_action('transition_post_status', function($new_status, $old_status, $post){\r\n\r\n  global $wpdb;\r\n\r\n  <strong>if($new_status === 'publish' &amp;&amp; in_array($old_status, ['draft', 'future'], true) &amp;&amp; $post-&gt;post_type === 'post') {<\/strong> \/\/ \u521d\u56de\u6295\u7a3f\u306e\u6642\u3060\u3051\r\n\r\n    $tweet = \"\u300c{$post-&gt;post_title}\u300d\u3068\u3044\u3046\u8a18\u4e8b\u3092\u516c\u958b\u3057\u307e\u3057\u305f\uff01\\n\\n{$post-&gt;guid}\";\r\n\r\n    \/\/ \ud83d\udc47 \u30cf\u30c3\u30b7\u30e5\u30bf\u30b0\r\n    $categories = get_the_category($post-&gt;ID);\r\n\r\n    if(count($categories) &gt; 0) {\r\n\r\n      $tweet .= \"\\n\\n\";\r\n\r\n      foreach($categories as $category) {\r\n\r\n        if(intval($category-&gt;term_id) === 1) { \/\/ \ud83d\udc48 \u672a\u5206\u985e\u306f\u9664\u5916\r\n\r\n          continue;\r\n\r\n        }\r\n\r\n        $category_name = str_replace(['.'], '', $category-&gt;name);\r\n        $tweet .= \"#{$category_name} \";\r\n\r\n      }\r\n\r\n    }\r\n\r\n    \/\/ \ud83d\udc47 \u30a2\u30a4\u30ad\u30e3\u30c3\u30c1\u753b\u50cf\r\n    $table = $wpdb-&gt;prefix .'postmeta';\r\n    $thumbnail_meta = $wpdb-&gt;get_row(\r\n      $wpdb-&gt;prepare(\"SELECT * FROM {$table} WHERE post_id = %d AND meta_key = %s\", [\r\n        $post-&gt;ID,\r\n        '_thumbnail_id'\r\n      ])\r\n    );\r\n    $image_path = '';\r\n\r\n    if(!is_null($thumbnail_meta)) {\r\n\r\n      $thumbnail_id = $thumbnail_meta-&gt;meta_value;\r\n      $attachment = wp_get_attachment_metadata($thumbnail_id);\r\n      $image_path = wp_upload_dir()['basedir'] .'\/'. $attachment['file'];\r\n\r\n    }\r\n\r\n    \/\/ Twitter\u6295\u7a3f\r\n    require_once ABSPATH .'vendor\/autoload.php';\r\n    $connection = new \\Abraham\\TwitterOAuth\\TwitterOAuth(\r\n      TWITTER_CONSUMER_KEY,\r\n      TWITTER_CONSUMER_SECRET,\r\n      TWITTER_ACCESS_TOKEN,\r\n      TWITTER_ACCESS_SECRET\r\n    );\r\n    $parameters = ['status' =&gt; $tweet];\r\n\r\n    if(!empty($image_path)) { \/\/ \ud83d\udc48 \u753b\u50cf\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\r\n\r\n      $connection-&gt;setTimeouts(15, 30); \/\/ \u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u6642\u9593\u3092\u4f38\u3070\u3059\r\n\r\n      try {\r\n\r\n        $media = $connection-&gt;upload('media\/upload', [\r\n          'media' =&gt; $image_path\r\n        ]);\r\n        $parameters['media_ids'] = $media-&gt;media_id_string;\r\n\r\n      } catch (\\Exception $e) {}\r\n\r\n    }\r\n\r\n    <strong>$connection-&gt;post('statuses\/update', $parameters);<\/strong> \/\/ \ud83d\udc48 Twitter\u306b\u6295\u7a3f\r\n\r\n  }\r\n\r\n}, 10, 3);<\/pre>\n<p><strong>\u3010\u8ffd\u8a18\uff1a2022.2.27\u3011<\/strong><br \/>\n\u30ab\u30c6\u30b4\u30ea\u540d\u306b\u300c\u30c9\u30c3\u30c8\u300d\u304c\u5165\u3063\u3066\u3044\u308b\u3068\u30cf\u30c3\u30b7\u30e5\u30bf\u30b0\u304c\u9014\u4e2d\u3067\u5207\u308c\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u30c9\u30c3\u30c8\u306f\u53d6\u308a\u9664\u304f\u51e6\u7406\u3092\u5165\u308c\u307e\u3057\u305f\u3002<\/p>\n<p><strong>\u3010\u8ffd\u8a18\uff1a2023.4.4\u3011<\/strong><br \/>\n\u307f\u306a\u3055\u3093\u77e5\u3063\u3066\u306e\u3068\u304a\u308a\u3001<code>Twitter API<\/code>\u306e\u5236\u9650\u30eb\u30fc\u30eb\u304c\u5909\u308f\u3063\u3066\u3057\u307e\u3063\u305f\u305f\u3081\u3001\u30b3\u30fc\u30c9\u3092\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u5909\u66f4\u3057\u307e\u3057\u305f\u3002<\/p>\n<p><strong>\u3010\u8ffd\u8a18\uff1a2024.2.18\u3011<\/strong>\u4e88\u7d04\u6295\u7a3f\u3092\u4f7f\u3063\u305f\u5834\u5408\u3001\uff12\u56de\u5b9f\u884c\u3055\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u306e\u3067\u30b3\u30fc\u30c9\u3092\u4fee\u6b63\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u306a\u304a\u3001\u3053\u306e\u5909\u66f4\u306b\u4f34\u3063\u3066\u3001API\u30d0\u30fc\u30b8\u30e7\u30f3\u306f\uff12\u306b\u5909\u66f4\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u306e\u3067\u3001<code>Abraham\/TwitterOAuth<\/code>\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u30823.0.0\u4ee5\u4e0a\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001<code>Twitter API<\/code>\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\uff12\u306b\u306f\u30d5\u30a1\u30a4\u30eb\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306f\u5b58\u5728\u3057\u3066\u3044\u306a\u3044\uff08\ud83d\ude2b\uff09\u305f\u3081\u3001<strong><a href=\"https:\/\/wordpress.org\/plugins\/wonderm00ns-simple-facebook-open-graph-tags\/\" target=\"_blank\" rel=\"noopener\">Open Graph and Twitter Card Tags<\/a><\/strong>\u3068\u3044\u3046\u30d7\u30e9\u30b0\u30a4\u30f3\u3067<code>Twitter<\/code>\u30ab\u30fc\u30c9\u306b\u5bfe\u5fdc\u3055\u305b\u3001\u30c4\u30a4\u30fc\u30c8\u5185\u5bb9\u306b\u30d6\u30ed\u30b0\u8a18\u4e8b\u306eURL\u3092\u542b\u3081\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<div>\n<pre>add_action('transition_post_status', function($new_status, $old_status, $post){\r\n\r\n    global $wpdb;\r\n\r\n    if($new_status === 'publish' &amp;&amp; in_array($old_status, ['draft', 'future'], true) &amp;&amp; $post-&gt;post_type === 'post') {\r\n\r\n        $tweet = \"{$post-&gt;post_title} \\n\u3068\u3044\u3046\u8a18\u4e8b\u3092\u516c\u958b\u3057\u307e\u3057\u305f\uff01\\n\u305c\u3072\u3054\u89a7\u304f\u3060\u3055\u3044\u3002\\n\\n{$post-&gt;guid}\";\r\n\r\n\r\n        \/\/ Category\r\n        $categories = get_the_category($post-&gt;ID);\r\n\r\n        if(count($categories) &gt; 0) {\r\n\r\n            $tweet .= \"\\n\\n\";\r\n\r\n            foreach($categories as $category) {\r\n\r\n                if(intval($category-&gt;term_id) === 1) {\r\n\r\n                    continue;\r\n\r\n                }\r\n\r\n                $category_name = str_replace(['.', ' '], '', $category-&gt;name);\r\n                $tweet .= \"#{$category_name} \";\r\n\r\n            }\r\n\r\n        }\r\n\r\n        require_once ABSPATH .'vendor\/autoload.php';\r\n        $connection = new \\Abraham\\TwitterOAuth\\TwitterOAuth(\r\n            TWITTER_CONSUMER_KEY,\r\n            TWITTER_CONSUMER_SECRET,\r\n            TWITTER_ACCESS_TOKEN,\r\n            TWITTER_ACCESS_SECRET\r\n        );\r\n        $connection-&gt;setAPiVersion('2');\r\n\r\n        $parameters = ['text' =&gt; $tweet];\r\n        $connection-&gt;post('tweets', $parameters, true); \/\/ \u7b2c\uff13\u5f15\u6570\u306f\u91cd\u8981\uff08JSON\u5316\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u306e\u3067\uff09\r\n\r\n    }\r\n\r\n}, 10, 3);<\/pre>\n<p><strong>\u3010\u8ffd\u8a18\uff1a2024.2.18\u3011<\/strong>\u4e88\u7d04\u6295\u7a3f\u3092\u4f7f\u3063\u305f\u5834\u5408\u3001\uff12\u56de\u5b9f\u884c\u3055\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u306e\u3067\u30b3\u30fc\u30c9\u3092\u4fee\u6b63\u3057\u307e\u3057\u305f\u3002<\/p>\n<\/div>\n<p>\u3053\u3053\u3067\u3001\u5148\u306b\u8a00\u3063\u3066\u304a\u304b\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u306e\u304c\u3001<strong>\u521d\u56de\u6295\u7a3f\u306e\u5834\u5408\u3001\u30bf\u30a4\u30c8\u30eb\u3068URL\u3060\u3051\u3057\u304b\u30c4\u30a4\u30fc\u30c8\u3067\u304d\u306a\u3044\u3053\u3068\u304c\u3042\u308b\ud83d\ude2b<\/strong>\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u5b9f\u306f\u3001<a href=\"https:\/\/core.trac.wordpress.org\/ticket\/46441\" target=\"_blank\" rel=\"noopener noreferrer\">\u3053\u3061\u3089\u306e\u30d0\u30b0\u5831\u544a\u30da\u30fc\u30b8<\/a>\u3067\u3042\u308b\u3088\u3046\u306b<code>Rest API<\/code>\u3067\u521d\u56de\u6295\u7a3f\u3057\u305f\u3068\u304d\u306f\u3001\u8a2d\u5b9a\u3055\u308c\u305f\u30ab\u30c6\u30b4\u30ea\u304c\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3002\uff08<code>transition_post_status<\/code>\u304c\u5b9f\u884c\u3055\u308c\u305f\u5f8c\u3067\u30ab\u30c6\u30b4\u30ea\u767b\u9332\u3055\u308c\u308b\u307f\u305f\u3044\u3067\u3059\uff09\u305d\u3057\u3066\u3001\u3053\u308c\u306f\u30a2\u30a4\u30ad\u30e3\u30c3\u30c1\u753b\u50cf\u306b\u3064\u3044\u3066\u3082\u540c\u3058\u3067\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u3082\u3057<strong>\u30cf\u30c3\u30b7\u30e5\u30bf\u30b0\u3068\u30a2\u30a4\u30ad\u30e3\u30c3\u30c1\u753b\u50cf\u3082\u4e00\u7dd2\u306b\u81ea\u52d5\u30c4\u30a4\u30fc\u30c8\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u4e88\u7d04\u6295\u7a3f\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/strong><\/p>\n<p>\u203b\u4e88\u7d04\u6295\u7a3f\u3068\u306f\u3001\u4eca\u3059\u3050\u306b\u6295\u7a3f\u3059\u308b\u306e\u3067\u306f\u306a\u304f\u3042\u3089\u304b\u3058\u3081\u516c\u958b\u3059\u308b\u65e5\u6642\u3092\u6c7a\u3081\u3066\u304a\u304f\u8a2d\u5b9a\u306e\u3053\u3068\u3067\u3059\u3002\uff08\u3059\u307f\u307e\u305b\u3093\u3001\u30b0\u30fc\u30c6\u30f3\u30d9\u30eb\u30af\u306f\u597d\u304d\u3058\u3083\u306a\u3044\u306e\u3067\u4e0b\u306e\u753b\u50cf\u306f\u30af\u30e9\u30b7\u30c3\u30af\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u3059\u304c\u3001\u307b\u307c\u540c\u3058\u3082\u306e\u304c\u3042\u308b\u3068\u601d\u3044\u307e\u3059\ud83d\ude0a\uff09<\/p>\n<p><strong>\u3010\u8ffd\u8a18\uff1a2020.4.10\u3011<\/strong><code>wordpress 5.4<\/code>\u3067\u8a66\u3057\u305f\u3068\u3053\u308d\u3001\u4e88\u7d04\u6295\u7a3f\u3067\u3042\u3063\u3066\u3082\u753b\u50cf\u306f\u6295\u7a3f\u3067\u304d\u306a\u3044\u3088\u3046\u3067\u3057\u305f\u306e\u3067\u3001\u76f4\u63a5DB\u304b\u3089\u30c7\u30fc\u30bf\u53d6\u5f97\u3059\u308b\u3088\u3046\u5909\u66f4\u3057\u307e\u3057\u305f\u3002<br \/>\n<strong>\u3010\u8ffd\u8a18\uff1a2020.4.15\u3011<\/strong>\u30d7\u30e9\u30b0\u30a4\u30f3\u306b\u3088\u3063\u3066\u306f\u767b\u9332\u6642\u306b<code>Twitter\u6295\u7a3f<\/code>\u304c\u5b9f\u884c\u3055\u308c\u3066\u3057\u307e\u3046\u306e\u3067\u3001<code>$post-&gt;post_type<\/code>\u306e\u30c1\u30a7\u30c3\u30af\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6842\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/04\/wordpress_twitter_6.png\" alt=\"\" width=\"278\" height=\"218\" \/><\/p>\n<p>\u203b\u306a\u304a\u3001<a href=\"https:\/\/wordpress.org\/plugins\/classic-editor\/\" target=\"_blank\" rel=\"noopener noreferrer\">classic editor<\/a>\u3067\u306f<code>Rest API<\/code>\u3092\u4f7f\u3063\u3066\u3044\u306a\u3044\u3088\u3046\u3067\u3001\u521d\u56de\u6295\u7a3f\u3067\u3082\u30ab\u30c6\u30b4\u30ea\u3068\u753b\u50cf\u3092\u6295\u7a3f\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u306f\u3001\u30b3\u30fc\u30c9\u306e\u5185\u5bb9\u3067\u3059\u3002<\/p>\n<p>\u307e\u305a<code>transition_post_status<\/code>\u304c\u7528\u610f\u3057\u3066\u304f\u308c\u308b<code>$new_status<\/code>\u3068<code>$old_status<\/code>\u3067\u521d\u56de\u6295\u7a3f\u3092\u5224\u5225\u3057\u3001\u81ea\u52d5\u6295\u7a3f\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002\uff08\u3064\u307e\u308a\u3001\u66f4\u65b0\u306e\u3068\u304d\u306f\u30c4\u30a4\u30fc\u30c8\u3055\u308c\u306a\u3044\uff09<\/p>\n<p>\u305d\u3057\u3066\u3001\u5148\u307b\u3069\u306e\u901a\u5e38\u306e\u521d\u56de\u6295\u7a3f\u306e\u554f\u984c\u304c\u3042\u308b\u306e\u3067\u3001\u30cf\u30c3\u30b7\u30e5\u30bf\u30b0\u306b\u4f7f\u3046<strong>\u30ab\u30c6\u30b4\u30ea\u3068\u30a2\u30a4\u30ad\u30e3\u30c3\u30c1\u753b\u50cf\u306f\u3001\u3082\u3057\u60c5\u5831\u304c\u53d6\u5f97\u3067\u304d\u305f\u6642\u3060\u3051\u4e00\u7dd2\u306b\u6295\u7a3f\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/strong><\/p>\n<p>\u5f8c\u306f\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u307b\u3068\u3093\u3069\u306e\u90e8\u5206\u3092\u3084\u3063\u3066\u304f\u308c\u308b\u306e\u3067<code>post()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3059\u3060\u3051\u3067\u5b8c\u4e86\u3057\u307e\u3059\u3002<\/p>\n<p><strong>\u3010\u8ffd\u8a18\uff1a2023.7.12\u3011<br \/>\n<\/strong>\uff08\uff13\u30f6\u6708\u3076\u308a\uff12\u56de\u76ee\uff09\u307f\u306a\u3055\u3093\u77e5\u3063\u3066\u306e\u3068\u304a\u308a\u3001<code>Twitter API<\/code>\u306e\u5236\u9650\u30eb\u30fc\u30eb\u304c\u5909\u308f\u3063\u3066\u3057\u307e\u3063\u305f\u305f\u3081\u3001\u3082\u3046Twitter\u306b\u81ea\u52d5\u3067\u30c4\u30a4\u30fc\u30c8\u3059\u308b\u3053\u3068\u306f\u3042\u304d\u3089\u3081\u307e\u3057\u305f\u3002\u305d\u3053\u3067\u8003\u3048\u305f\u306e\u304c\u81ea\u5206\u81ea\u4fe1\u306b\u30e1\u30fc\u30eb\u3067\u901a\u77e5\u3059\u308b\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a\u3001<code>Intent<\/code>\u30ea\u30f3\u30af\u3092\u81ea\u5206\u306b\u9001\u4fe1\u3057\u3001\u305d\u306e\u30ea\u30f3\u30af\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u3089\u81ea\u52d5\u3067\u30c4\u30a4\u30fc\u30c8\u5185\u5bb9\u304c\u30bb\u30c3\u30c8\u3055\u308c\u305f\u72b6\u614b\u306b\u3059\u308b\u308f\u3051\u3067\u3059\u3002\u305d\u3057\u3066\u3001\u753b\u50cf\u306f\u3061\u3087\u3063\u3068\u30e1\u30f3\u30c9\u30af\u30b5\u30a4\u3067\u3059\u304c\u3001\u30e1\u30fc\u30eb\u306b\u6dfb\u4ed8\u3057\u3066\u624b\u52d5\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u30c4\u30a4\u30fc\u30c8\u306b\u8cbc\u308a\u4ed8\u3051\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u65b9\u6cd5\u6b21\u306e\u9805\u76ee\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<h1>Intent \u30ea\u30f3\u30af\u3092\u30e1\u30fc\u30eb\u9001\u4fe1\u3059\u308b\u65b9\u6cd5<\/h1>\n<p>\u5148\u307b\u3069\u306e\u9805\u76ee\u3067\u3082\u89e6\u308c\u307e\u3057\u305f\u304c\u3001<code>Twitter API<\/code>\u304c\u305d\u306e\u5f8c\u3082\u30ab\u30aa\u30b9\u72b6\u614b\u306b\u306a\u308a\u3001\u3082\u3046\u6b63\u76f4\u3042\u307e\u308a\u672a\u6765\u306f\u660e\u308b\u304f\u306a\u3044\u306a\u2026\u3068\u611f\u3058\u305f\u305f\u3081\u3001\u79c1\u81ea\u4fe1<code>API<\/code>\u3092\u4f7f\u3046\u3053\u3068\u306f\u3042\u304d\u3089\u3081\u3066\uff08\u4eca\u5f8c\u3082\u3053\u3093\u306a\u611f\u3058\u306a\u3089<code>Twitter<\/code>\u81ea\u4f53\u3092\u79fb\u884c\u304b\u3082\u2026\ud83e\udd14\uff09<code>Intent<\/code> \u30ea\u30f3\u30af\u3092\u30e1\u30fc\u30eb\u9001\u4fe1\u3059\u308b\u65b9\u6cd5\u306b\u5207\u308a\u66ff\u3048\u307e\u3057\u305f\u3002<\/p>\n<p><code>Intent<\/code>\u30ea\u30f3\u30af\u3068\u3044\u3046\u306e\u306f\u30b7\u30f3\u30d7\u30eb\u306b\u8a00\u3046\u3068\u300c\u30c4\u30a4\u30fc\u30c8\u5185\u5bb9\u304c\u57cb\u3081\u8fbc\u307e\u308c\u305fURL\uff08\u30ea\u30f3\u30af\uff09\u300d\u306e\u3053\u3068\u3067\u3001\u30af\u30ea\u30c3\u30af\u3059\u308b\u3060\u3051\u3067\u305d\u306e\u30c4\u30a4\u30fc\u30c8\u5185\u5bb9\u304c\u30bb\u30c3\u30c8\u3055\u308c\u305f\u72b6\u614b\u304b\u3089\u59cb\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a\u3001\u30e1\u30fc\u30eb\u304c\u5c4a\u3044\u305f\u3089\u30af\u30ea\u30c3\u30af\u3057\u3066\u81ea\u5206\u3067\u30c4\u30a4\u30fc\u30c8\u3059\u308b\u3068\u3044\u3046\u4f5c\u6226\u3067\u3059\u306d\u3002<\/p>\n<p>\u3067\u306f\u3001\u3084\u308a\u304b\u305f\u3067\u3059\u3002<\/p>\n<p>\u307e\u305a\u3001<code>wordpress<\/code>\u306b\u306f<code>wp_mail()<\/code>\u3068\u3044\u3046\u95a2\u6570\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u79c1\u306e\u74b0\u5883\u3067\u306f\u305d\u3082\u305d\u3082<code>mail()<\/code>\u95a2\u6570\u304c\u4f7f\u3048\u306a\u3044\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u305f\u306e\u3067\u3001\u3053\u306e\u95a2\u6570\u3092\u6539\u9020\u3057\u3066<code>gmail<\/code>\u7d4c\u7531\u3067\u30e1\u30fc\u30eb\u9001\u4fe1\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002\uff08\u305d\u306e\u305f\u3081\u3001\u3082\u3057\u30e1\u30fc\u30eb\u9001\u4fe1\u3067\u304d\u308b\u74b0\u5883\u3067\u3042\u308c\u3070\u3053\u3053\u306f\u98db\u3070\u3057\u3066\u3082<code>OK<\/code>\u3067\u3059\uff09<\/p>\n<p><strong>\/wp-includes\/pluggable.php<\/strong><\/p>\n<pre>\/\/ Send!\r\ntry {\r\n\r\n    \/\/ GMail \u7d4c\u7531\u3067\u30e1\u30fc\u30eb\u9001\u4fe1\r\n<strong>    $phpmailer-&gt;IsHTML(true);\r\n    $phpmailer-&gt;IsSMTP();\r\n    $phpmailer-&gt;Host = 'smtp.gmail.com';\r\n    $phpmailer-&gt;Port = 465;\r\n    $phpmailer-&gt;SMTPAuth = true;\r\n    $phpmailer-&gt;Username = '\uff08\u3042\u306a\u305f\u306e\u30e6\u30fc\u30b6\u30fc\u540d\uff09';\r\n    $phpmailer-&gt;Password = '\uff08\u3053\u3053\u306f\u3042\u306a\u305f\u306e\u30a2\u30d7\u30ea\u30d1\u30b9\u30ef\u30fc\u30c9\uff09';\r\n    $phpmailer-&gt;SMTPSecure = 'ssl';<\/strong>\r\n    \r\n    $send = $phpmailer-&gt;send();\r\n<\/pre>\n<p>\u203b \u592a\u5b57\u90e8\u5206\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u308c\u3067<code>GMail<\/code>\u7d4c\u7531\u3067\u30e1\u30fc\u30eb\u9001\u4fe1\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u7d9a\u3044\u3066\u306f\u3001<code>functions.php<\/code>\u3067\u3059\u3002\uff08\u524d\u9805\u76ee\u3067\u7d39\u4ecb\u3057\u305f\u3082\u306e\u3092\u5165\u308c\u66ff\u3048\u3066\u304f\u3060\u3055\u3044\uff09<\/p>\n<pre><strong>add_action('transition_post_status', function($new_status, $old_status, $post){\r\n\r\n  global $wpdb;\r\n\r\n  if($new_status === 'publish' &amp;&amp; in_array($old_status, ['draft', 'future'], true) &amp;&amp; $post-&gt;post_type === 'post') { \/\/ \u521d\u56de\u6295\u7a3f\u306e\u6642\u3060\u3051\r\n\r\n    \/\/ \u30c4\u30a4\u30fc\u30c8\u5185\u5bb9\r\n    $tweet_content = \"{$post-&gt;post_title} \\n\u3068\u3044\u3046\u8a18\u4e8b\u3092\u516c\u958b\u3057\u307e\u3057\u305f\uff01\\n\u305c\u3072\u3054\u89a7\u304f\u3060\u3055\u3044\u3002\\n\\n{$post-&gt;guid}\";\r\n\r\n    $categories = get_the_category($post-&gt;ID);\r\n\r\n    if(count($categories) &gt; 0) {\r\n\r\n      $tweet_content .= \"\\n\\n\";\r\n\r\n      foreach($categories as $category) {\r\n\r\n        if(intval($category-&gt;term_id) === 1) {\r\n\r\n          continue;\r\n\r\n        }\r\n\r\n        $category_name = str_replace(['.', ' '], '', $category-&gt;name);\r\n        $tweet_content .= \"#{$category_name} \";\r\n\r\n      }\r\n\r\n    }\r\n    \r\n    $message = '\ud83d\udc26 \u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\uff06\u30b3\u30d4\u30da\u3057\u3066 Twitter \u3078\u6295\u7a3f\u3059\u308b&lt;br&gt;';\r\n    $message .= '&lt;textarea&gt;https:\/\/twitter.com\/intent\/tweet?text='. urlencode($tweet_content) .'&lt;\/textarea&gt;';\r\n\r\n    \/\/ \u30a2\u30a4\u30ad\u30e3\u30c3\u30c1\u753b\u50cf\r\n    $table = $wpdb-&gt;prefix .'postmeta';\r\n    $thumbnail_meta = $wpdb-&gt;get_row(\r\n      $wpdb-&gt;prepare(\"SELECT * FROM {$table} WHERE post_id = %d AND meta_key = %s\", [\r\n        $post-&gt;ID,\r\n        '_thumbnail_id'\r\n      ])\r\n    );\r\n    $image_path = '';\r\n\r\n    if(!is_null($thumbnail_meta)) {\r\n\r\n      $thumbnail_id = $thumbnail_meta-&gt;meta_value;\r\n      $attachment = wp_get_attachment_metadata($thumbnail_id);\r\n      $image_path = wp_upload_dir()['basedir'] .'\/'. $attachment['file'];\r\n\r\n    }\r\n\r\n    $to = '\uff08\u3053\u3053\u306b\u30e1\u30fc\u30eb\u3092\u53d7\u4fe1\u3057\u305f\u3044\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\uff09'; \/\/ \u9001\u4fe1\u5148\u306e\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\r\n    $subject = get_bloginfo('name') .'\u306e\u8a18\u4e8b\u3092 Tweet \u3057\u307e\u3057\u3087\u3046\uff01';\r\n    $attachments = [$image_path];\r\n\r\n    wp_mail($to, $subject, $message, [], $attachments); \/\/ \u3053\u3053\u3067\u30e1\u30fc\u30eb\u9001\u4fe1\r\n\r\n  }\r\n\r\n}, 10, 3);<\/strong><\/pre>\n<p><strong>\u3010\u8ffd\u8a18\uff1a2024.2.18\u3011<\/strong>\u4e88\u7d04\u6295\u7a3f\u3092\u4f7f\u3063\u305f\u5834\u5408\u3001\uff12\u56de\u5b9f\u884c\u3055\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u306e\u3067\u30b3\u30fc\u30c9\u3092\u4fee\u6b63\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u9001\u4fe1\u3059\u308b\u5185\u5bb9\u3068\u3057\u3066\u306f\u3001\u5148\u307b\u3069\u8a00\u3063\u305f<code>Intent URL<\/code>\u3092\u4f5c\u6210\u3057\u3001\u3082\u3057\u30a2\u30a4\u30ad\u30e3\u30c3\u30c1\u753b\u50cf\u304c\u3042\u308b\u306a\u3089\u6dfb\u4ed8\u3057\u3066\u30e1\u30fc\u30eb\u9001\u4fe1\u3059\u308b\u6d41\u308c\u3067\u3059\u3002<\/p>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u30c0\u30df\u30fc\u306e\u6295\u7a3f\u3092\u3057\u3066\u30bf\u30a4\u30e0\u30e9\u30a4\u30f3\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u307f\u308b\u3068\u6b21\u306e\u3088\u3046\u306b\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6851\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/04\/wordpress_twitter_7.png\" alt=\"\" width=\"593\" height=\"480\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/04\/wordpress_twitter_7.png 593w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/04\/wordpress_twitter_7-300x243.png 300w\" sizes=\"auto, (max-width: 593px) 100vw, 593px\" \/><\/p>\n<p>\u6210\u529f\u3067\u3059\ud83d\ude0a\u2728<\/p>\n<h1>\u3061\u306a\u307f\u306b\uff1a\u30a8\u30e9\u30fc\u304c\u51fa\u305f\u3089<\/h1>\n<p>\u3061\u306a\u307f\u306b\u753b\u50cf\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30a8\u30e9\u30fc\u304c\u3067\u305f\u3089\u3001\u305d\u308c\u306f\u3001<strong>\u753b\u50cf\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3088\u3046\u3068\u3057\u305f\u3051\u3069\u6642\u9593\u5185\u306b\u5b8c\u4e86\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/strong>\u3068\u3044\u3046\u610f\u5473\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><strong>Uncaught Abraham\\TwitterOAuth\\TwitterOAuthException: Operation timed out after \uff08\u6570\u5b57\uff09<\/strong><\/pre>\n<p>\u3082\u3057\u3053\u306e\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u5834\u5408\u306f\u3001<code>setTimeouts()<\/code>\u3092\u8abf\u6574\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>$connection-&gt;setTimeouts(15, 30);<\/strong><\/pre>\n<p>\uff11\u3064\u3081\u306e\u5f15\u6570\u304c\u63a5\u7d9a\u306e\u6700\u5927\u79d2\u6570\u3001\uff12\u3064\u76ee\u304c\u30ea\u30af\u30a8\u30b9\u30c8\uff08\u3053\u306e\u5834\u5408\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\uff09\u306e\u6700\u5927\u79d2\u6570\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f<code>wordpress<\/code>\u306b\u72ec\u81ea\u306e\u81ea\u52d5\u30c4\u30a4\u30fc\u30c8\u6a5f\u80fd\u3092\u8ffd\u52a0\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u3082\u3061\u308d\u3093\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f7f\u3063\u3066\u3082\u3046\u307e\u304f\u3044\u304f\u3093\u3067\u3057\u3087\u3046\u304c\u3001\u30d7\u30e9\u30b0\u30a4\u30f3\u306f\u4f55\u304b\u3068\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u9045\u304f\u3059\u308b\u539f\u56e0\u306b\u306a\u308b\u306e\u3067\u3001\u305d\u308c\u304c\u30a4\u30e4\u306a\u65b9\u306f\u305c\u3072\u4eca\u56de\u306e\u30b3\u30fc\u30c9\u3092\u4f7f\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n<p>\u306a\u304a\u3001\u5192\u982d\u3067\u3082\u7d39\u4ecb\u3057\u307e\u3057\u305f\u304c\u4eca\u5f8c\u306f\u8a18\u4e8b\u304c\u516c\u958b\u3055\u308c\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u4ee5\u4e0b\u306e\u30c4\u30a4\u30c3\u30bf\u30fc\u3067\u304a\u77e5\u3089\u305b\u3092\u3057\u307e\u3059\u306e\u3067\u3001\u305c\u3072\u30d5\u30a9\u30ed\u30fc\u3057\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n<p><a href=\"https:\/\/twitter.com\/SukohiKuhoh\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6852\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/04\/twitter_home.png\" alt=\"\" width=\"200\" height=\"128\" \/><\/a><br \/>\n<a href=\"https:\/\/twitter.com\/SukohiKuhoh\" target=\"_blank\" rel=\"noopener noreferrer\">\u305c\u3072\u30d5\u30a9\u30ed\u30fc\u304a\u9858\u3044\u3044\u305f\u3057\u307e\u3059\ud83d\ude0a\u2728<\/a><\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\uff01<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3467 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9.png\" alt=\"\" width=\"216\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9.png 216w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_9-203x300.png 203w\" sizes=\"auto, (max-width: 216px) 100vw, 216px\" \/><\/p>\n<p style=\"text-align: center;\">\u300c\u7d04\uff13\u5e74\u3082\u30c4\u30a4\u30c3\u30bf\u30fc\u3092\u653e\u7f6e\u3057\u3066\u307e\u3057\u305f\ud83d\ude02\u300d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u4ee5\u524d\u3053\u306e\u30d6\u30ed\u30b0\u3067\u306f\u8a18\u4e8b\u3092\u516c\u958b\u3059\u308b\u3068\u304d\u3001\u4ee5\u4e0b\u306e\u30c4\u30a4\u30c3\u30bf\u30fc\u3067\u304a\u77e5\u3089\u305b\u3057\u3066\u3044\u307e\u3057\u305f\u3002 \u3010\u304a\u77e5\u3089\u305b\u3092\u3057\u3066\u3044\u305f\u30c4\u30a4\u30c3\u30bf\u30fc\u3011 \u5b9f\u306f\u5f53\u6642\u3001\u3042\u308b\u30b5\u30fc\u30d3\u30b9\u3067\u81ea\u52d5\u6295\u7a3f\u3057\u3066 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=6825\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u3010wordpress\u3011\u30d7\u30e9\u30b0\u30a4\u30f3\u306a\u3057\u3067Twitter\u306b\u81ea\u52d5\u6295\u7a3f\u3059\u308b&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":6871,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59],"tags":[192],"class_list":["post-6825","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","tag-twitter"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/6825","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6825"}],"version-history":[{"count":41,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/6825\/revisions"}],"predecessor-version":[{"id":12468,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/6825\/revisions\/12468"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/6871"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6825"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6825"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6825"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}