{"id":6727,"date":"2024-10-24T11:18:39","date_gmt":"2024-10-24T02:18:39","guid":{"rendered":"https:\/\/code-plus.jp\/gp\/?p=6727"},"modified":"2026-01-08T11:16:37","modified_gmt":"2026-01-08T02:16:37","slug":"post-6727","status":"publish","type":"post","link":"https:\/\/code-plus.jp\/gp\/post-6727\/","title":{"rendered":"WordPress\u306e\u7ba1\u7406\u753b\u9762\u306b\u30d5\u30a9\u30fc\u30e0\u306e\u9001\u4fe1\u5148\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u8868\u793a\u3055\u305b\u308b\u30ab\u30b9\u30bf\u30de\u30a4\u30ba"},"content":{"rendered":"<p>WordPress\u306e\u7ba1\u7406\u753b\u9762\u3067\u3001\u5404\u30d5\u30a9\u30fc\u30e0\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u9001\u4fe1\u5148\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u4e00\u5143\u7ba1\u7406\u3057\u3001\u5e38\u306b\u78ba\u8a8d\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\r\n<h2>1. \u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306e\u5b9a\u6570\u5b9a\u7fa9\uff08shortcodes.php\uff09<\/h2>\r\n<pre><code class=\"language-php\">\/* \u9001\u4fe1\u5148\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9(To:)\u306e\u5b9a\u6570\u5b9a\u7fa9 *\/\r\n$my_recipients = &quot;info@example.com&quot;;\r\n\/\/ $my_recipients2 = &quot;&quot;;  \/\/ \u5fc5\u8981\u306b\u5fdc\u3058\u3066\u8ffd\u52a0\r\n\/\/ $my_recipients3 = &quot;&quot;;\r\n\/\/ $my_recipients4 = &quot;&quot;;\r\n<\/code><\/pre>\r\n<h2>2. \u30e1\u30fc\u30eb\u30bf\u30b0\u306e\u8a2d\u5b9a<\/h2>\r\n<h3>MW WP Form \u7528\u306e\u30e1\u30fc\u30eb\u30bf\u30b0\u8a2d\u5b9a<\/h3>\r\n<pre><code class=\"language-php\">\/*\u300eMW WP Form\u300f{\u30e1\u30fc\u30eb\u30bf\u30b0} \u8a2d\u5b9a *\/\r\nfunction add_sender_info($value, $key, $insert_contact_data_id) {\r\n    global $my_recipients, $my_recipients2, $my_recipients3, $my_recipients4;\r\n    \r\n    \/\/ \u30ad\u30fc\u3068\u5909\u6570\u306e\u5bfe\u5fdc\u3092\u914d\u5217\u3067\u5b9a\u7fa9\r\n    $recipients_map = array(\r\n        &#39;my_recipients&#39; =&gt; $my_recipients,\r\n        &#39;my_recipients2&#39; =&gt; $my_recipients2,\r\n        &#39;my_recipients3&#39; =&gt; $my_recipients3,\r\n        &#39;my_recipients4&#39; =&gt; $my_recipients4\r\n    );\r\n    \r\n    \/\/ \u30ad\u30fc\u304c\u5b58\u5728\u3057\u3001\u5024\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u306f\u305d\u306e\u5024\u3092\u8fd4\u3059\r\n    if (isset($recipients_map[$key]) &amp;&amp; $recipients_map[$key]) {\r\n        return $recipients_map[$key];\r\n    }\r\n    \r\n    return $value;\r\n}\r\nadd_filter(&#39;mwform_custom_mail_tag&#39;, &#39;add_sender_info&#39;, 10, 3);\r\n<\/code><\/pre>\r\n<h3>Contact Form 7 \u7528\u306e\u30e1\u30fc\u30eb\u30bf\u30b0\u8a2d\u5b9a<\/h3>\r\n<pre><code class=\"language-php\">\/*\u300eContact Form 7\u300f[_\u30e1\u30fc\u30eb\u30bf\u30b0] \u8a2d\u5b9a *\/\r\nfunction add_wpcf7_recipients($output, $name) {\r\n    global $my_recipients, $my_recipients2, $my_recipients3, $my_recipients4;\r\n    \r\n    \/\/ \u30bf\u30b0\u3068\u5909\u6570\u306e\u5bfe\u5fdc\u3092\u914d\u5217\u3067\u5b9a\u7fa9\r\n    $recipients_map = array(\r\n        &#39;_my_recipients&#39; =&gt; $my_recipients,\r\n        &#39;_my_recipients2&#39; =&gt; $my_recipients2,\r\n        &#39;_my_recipients3&#39; =&gt; $my_recipients3,\r\n        &#39;_my_recipients4&#39; =&gt; $my_recipients4\r\n    );\r\n    \r\n    \/\/ \u30bf\u30b0\u304c\u5b58\u5728\u3057\u3001\u5024\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u306f\u305d\u306e\u5024\u3092\u8fd4\u3059\r\n    if (isset($recipients_map[$name]) &amp;&amp; $recipients_map[$name]) {\r\n        return $recipients_map[$name];\r\n    }\r\n    \r\n    return $output;\r\n}\r\nadd_filter(&#39;wpcf7_special_mail_tags&#39;, &#39;add_wpcf7_recipients&#39;, 10, 2);\r\n<\/code><\/pre>\r\n<h3>MTS Simple Booking \u306e\u9001\u4fe1\u5148\u5236\u5fa1<\/h3>\r\n<pre><code class=\"language-php\">\/* MTS Simple Booking\u306e\u9001\u4fe1\u5148\u5236\u5fa1 *\/\r\nadd_filter(&#39;mtssb_option_premise&#39;, function($premise) {\r\n    global $my_recipients, $my_recipients2, $my_recipients3, $my_recipients4;\r\n    \r\n    if ($my_recipients) {\r\n        $premise[&#39;email&#39;] = $my_recipients;\r\n    }\r\n    if ($my_recipients2) {\r\n        $premise[&#39;email2&#39;] = $my_recipients2;\r\n    }\r\n    if ($my_recipients3) {\r\n        $premise[&#39;email3&#39;] = $my_recipients3;\r\n    }\r\n    if ($my_recipients4) {\r\n        $premise[&#39;email4&#39;] = $my_recipients4;\r\n    }\r\n    \r\n    return $premise;\r\n});\r\n<\/code><\/pre>\r\n<h2>3. \u7ba1\u7406\u753b\u9762\u3067\u306e\u8868\u793a\u8a2d\u5b9a\uff08admin-style.php\uff09<\/h2>\r\n<pre><code class=\"language-php\">\/* \u7ba1\u7406\u753b\u9762\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba *\/\r\nfunction wp_admin_custom() {\r\n    echo &#39;&lt;style&gt;\r\n    \/* \u9001\u4fe1\u5148\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9(To:)\u3092\u8868\u793a *\/\r\n    #wp-admin-bar-mail_recipients {\r\n        pointer-events: none;\r\n        position: absolute !important;\r\n        z-index: 10;\r\n        top: 32px;\r\n        left: 0px;\r\n        margin: auto;\r\n    }\r\n    #wp-admin-bar-mail_recipients .ab-item {\r\n        height: auto !important;\r\n        padding: 0.5em 3em 0.5em 19px !important;\r\n        background: var(--c-primary, hsl(223, 62%, 18%)) !important;\r\n        color: #FFF;\r\n        white-space: nowrap;\r\n    }\r\n    #wp-admin-bar-mail_recipients .ab-item:before {\r\n        position: relative;\r\n        display: inline-flex;\r\n        justify-content: center;\r\n        align-items: center;\r\n        width: 0;\r\n        height: 0.6em;\r\n        padding-right: 0.5em;\r\n        font-size: 160%;\r\n        font-family: &quot;Material Symbols Sharp&quot;;\r\n        font-variation-settings: &quot;FILL&quot; 1, &quot;wght&quot; 400;\r\n        content: &quot;\\\\f187&quot;;\r\n    }\r\n    &lt;\/style&gt;&#39;;\r\n}\r\nadd_action(&#39;admin_head&#39;, &#39;wp_admin_custom&#39;);\r\n\r\n\/* \u30a2\u30c9\u30df\u30f3\u30d0\u30fc\u306b\u9001\u4fe1\u5148\u8868\u793a *\/\r\nfunction add_mail_recipients_to_admin_bar($wp_admin_bar) {\r\n    global $my_recipients, $my_recipients2, $my_recipients3, $my_recipients4;\r\n    \r\n    $title = &#39;&lt;div style=&quot;line-height: 1.44;&quot;&gt;&#39;;\r\n    $title .= &quot;\u30e1\u30fc\u30eb\u9001\u4fe1\u5148(To:): $my_recipients&quot;;\r\n    if ($my_recipients2) $title .= &quot;&lt;br&gt;\u30e1\u30fc\u30eb\u9001\u4fe1\u51482(To:): $my_recipients2&quot;;\r\n    if ($my_recipients3) $title .= &quot;&lt;br&gt;\u30e1\u30fc\u30eb\u9001\u4fe1\u51483(To:): $my_recipients3&quot;;\r\n    if ($my_recipients4) $title .= &quot;&lt;br&gt;\u30e1\u30fc\u30eb\u9001\u4fe1\u51484(To:): $my_recipients4&quot;;\r\n    $title .= &quot;&lt;\/div&gt;&quot;;\r\n    \r\n    $args = array(\r\n        &#39;id&#39;    =&gt; &#39;mail_recipients&#39;,\r\n        &#39;title&#39; =&gt; $title,\r\n        &#39;meta&#39;  =&gt; array(&#39;class&#39; =&gt; &#39;mail-recipients&#39;)\r\n    );\r\n    $wp_admin_bar-&gt;add_node($args);\r\n}\r\nadd_action(&#39;admin_bar_menu&#39;, &#39;add_mail_recipients_to_admin_bar&#39;, 998);\r\n<\/code><\/pre>\r\n<h2>\u4f7f\u7528\u65b9\u6cd5<\/h2>\r\n<h3>\u30d5\u30a9\u30fc\u30e0\u3067\u306e\u30bf\u30b0\u4f7f\u7528<\/h3>\r\n<ul style=\"list-style-type:bullet;\">\r\n<li>MW WP Form: <code>{my_recipients}<\/code>, <code>{my_recipients2}<\/code> \u306a\u3069<\/li>\r\n<li>Contact Form 7: <code>[_my_recipients]<\/code>, <code>[_my_recipients2]<\/code> \u306a\u3069<\/li>\r\n<li>MTS Simple Booking: \u81ea\u52d5\u7684\u306b\u8a2d\u5b9a\u5024\u304c\u9069\u7528\u3055\u308c\u308b<\/li>\r\n<\/ul>\r\n<h3>\u8868\u793a\u78ba\u8a8d<\/h3>\r\n<p>\u7ba1\u7406\u753b\u9762\u4e0a\u90e8\u306b\u9001\u4fe1\u5148\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u304c\u5e38\u6642\u8868\u793a\u3055\u308c\u3001\u4e00\u76ee\u3067\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\r\n<h2>\u30e1\u30ea\u30c3\u30c8<\/h2>\r\n<ol style=\"list-style-type:decimal;\">\r\n<li><p><strong>\u4e00\u5143\u7ba1\u7406<\/strong><\/p>\r\n<ul style=\"list-style-type:bullet;\">\r\n<li>\u3059\u3079\u3066\u306e\u9001\u4fe1\u5148\u3092\u4e00\u7b87\u6240\u3067\u7ba1\u7406<\/li>\r\n<li>\u5909\u66f4\u304c\u5bb9\u6613<\/li>\r\n<li>\u30df\u30b9\u3092\u9632\u6b62<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li><p><strong>\u8996\u8a8d\u6027<\/strong><\/p>\r\n<ul style=\"list-style-type:bullet;\">\r\n<li>\u7ba1\u7406\u753b\u9762\u3067\u5e38\u6642\u78ba\u8a8d\u53ef\u80fd<\/li>\r\n<li>\u5206\u304b\u308a\u3084\u3059\u3044\u8868\u793a<\/li>\r\n<li>\u8907\u6570\u306e\u9001\u4fe1\u5148\u3092\u6574\u7406\u3057\u3066\u8868\u793a<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li><p><strong>\u30d7\u30e9\u30b0\u30a4\u30f3\u9023\u643a<\/strong><\/p>\r\n<ul style=\"list-style-type:bullet;\">\r\n<li>\u4e3b\u8981\u30d5\u30a9\u30fc\u30e0\u30d7\u30e9\u30b0\u30a4\u30f3\u306b\u5bfe\u5fdc<\/li>\r\n<li>\u7d71\u4e00\u7684\u306a\u7ba1\u7406\u304c\u53ef\u80fd<\/li>\r\n<li>\u8a2d\u5b9a\u306e\u7c21\u7565\u5316<\/li>\r\n<\/ul>\r\n<\/li>\r\n<li><p><strong>\u4fdd\u5b88\u6027<\/strong><\/p>\r\n<ul style=\"list-style-type:bullet;\">\r\n<li>\u30b3\u30fc\u30c9\u306e\u7ba1\u7406\u304c\u5bb9\u6613<\/li>\r\n<li>\u62e1\u5f35\u304c\u7c21\u5358<\/li>\r\n<li>\u30c7\u30d0\u30c3\u30b0\u304c\u5bb9\u6613<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ol>\r\n<h2>\u6ce8\u610f\u70b9<\/h2>\r\n<ul style=\"list-style-type:bullet;\">\r\n<li>Material Symbols \u30d5\u30a9\u30f3\u30c8\u306e\u8aad\u307f\u8fbc\u307f\u304c\u5fc5\u8981<\/li>\r\n<li>\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u306b\u3088\u308b\u5f71\u97ff\u306e\u78ba\u8a8d<\/li>\r\n<li>\u9001\u4fe1\u5148\u306e\u8ffd\u52a0\u6642\u306f\u30b3\u30fc\u30c9\u306e\u4fee\u6b63\u304c\u5fc5\u8981<\/li>\r\n<\/ul>\r\n<p>\u3053\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u306b\u3088\u308a\u3001\u8907\u6570\u306e\u30d5\u30a9\u30fc\u30e0\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f7f\u7528\u3059\u308b\u30b5\u30a4\u30c8\u3067\u3082\u3001\u9001\u4fe1\u5148\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306e\u7ba1\u7406\u304c\u52b9\u7387\u5316\u3055\u308c\u3001\u30df\u30b9\u3092\u9632\u3050\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\r\n","protected":false},"excerpt":{"rendered":"WordPress\u306e\u7ba1\u7406\u753b\u9762\u3067\u3001\u5404\u30d5\u30a9\u30fc\u30e0\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u9001\u4fe1\u5148\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u4e00\u5143\u7ba1\u7406\u3057\u3001\u5e38\u306b\u78ba\u8a8d\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002 1. \u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306e\u5b9a\u6570\u5b9a\u7fa9\uff08shortcodes.php\uff09 \/* \u9001\u4fe1[...]","protected":false},"author":1,"featured_media":6729,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":{"0":"post-6727","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-wordpress"},"_links":{"self":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/6727","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/comments?post=6727"}],"version-history":[{"count":1,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/6727\/revisions"}],"predecessor-version":[{"id":10331,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/6727\/revisions\/10331"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media\/6729"}],"wp:attachment":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media?parent=6727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/categories?post=6727"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/tags?post=6727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}