{"id":11876,"date":"2026-04-28T21:50:14","date_gmt":"2026-04-28T12:50:14","guid":{"rendered":"https:\/\/code-plus.jp\/gp\/?p=11876"},"modified":"2026-04-28T22:14:40","modified_gmt":"2026-04-28T13:14:40","slug":"wp-pokayoke-11876","status":"publish","type":"post","link":"https:\/\/code-plus.jp\/gp\/wp-pokayoke-11876\/","title":{"rendered":"\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8\u306b\u983c\u3089\u306a\u3044WordPress\u30b5\u30a4\u30c8\u904b\u7528\u306e\u30dd\u30ab\u30e8\u30b1\u8a2d\u8a08"},"content":{"rendered":"<p>\u30b5\u30a4\u30c8\u3092\u672c\u756a\u516c\u958b\u3057\u305f\u3089\u3001\u30c6\u30b9\u30c8\u74b0\u5883\u3068\u540c\u3058 Noindex \u8a2d\u5b9a\u306e\u307e\u307e\u3060\u3063\u305f\u3002\u5927\u898f\u6a21\u6539\u4fee\u5f8c\u306b Google Analytics \u306e\u30bf\u30b0\u304c\u8a08\u6e2c\u3067\u304d\u3066\u3044\u306a\u304b\u3063\u305f\u3002\u3053\u3046\u3044\u3063\u305f\u30df\u30b9\u306f\u300c\u6b21\u304b\u3089\u6c17\u3092\u3064\u3051\u3088\u3046\u300d\u3068\u601d\u3063\u3066\u3082\u3001\u307e\u305f\u7e70\u308a\u8fd4\u3059\u3002\u306a\u305c\u306a\u3089\u539f\u56e0\u306f\u300c\u6ce8\u610f\u529b\u304c\u8db3\u308a\u306a\u3044\u3053\u3068\u300d\u3067\u306f\u306a\u304f\u3001\u300c\u30df\u30b9\u304c\u3067\u304d\u308b\u69cb\u9020\u306b\u306a\u3063\u3066\u3044\u308b\u3053\u3068\u300d\u3060\u304b\u3089\u3067\u3059\u3002<\/p>\r\n<p class=\"mt-1r\">\u88fd\u9020\u696d\u306b\u306f<b class=\"fw-600\">\u300c\u30dd\u30ab\u30e8\u30b1\u300d<\/b>\u3068\u3044\u3046\u6982\u5ff5\u304c\u3042\u308a\u307e\u3059\u3002\u30c8\u30e8\u30bf\u751f\u7523\u65b9\u5f0f\u304b\u3089\u751f\u307e\u308c\u305f\u8a00\u8449\u3067\u3001\u30d2\u30e5\u30fc\u30de\u30f3\u30a8\u30e9\u30fc\u3092\u4eba\u306e\u6ce8\u610f\u529b\u306b\u983c\u3089\u305a\u3001\u69cb\u9020\u30fb\u4ed5\u7d44\u307f\u306b\u3088\u3063\u3066\u9632\u3050\u3068\u3044\u3046\u8003\u3048\u65b9\u3067\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001\u305d\u306e\u8003\u3048\u65b9\u3092 WordPress \u30b5\u30a4\u30c8\u904b\u7528\u306b\u5fdc\u7528\u3057\u305f\u5177\u4f53\u7684\u306a\u5b9f\u88c5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\r\n\r\n<!-- \u2605\u76ee\u6b21\u30ea\u30b9\u30c8 -->\r\n<ul class=\"tocList mt-1r\" data-toc-id=\"js-tocBWGD\" style=\"height:28rem\"><\/ul>\r\n<ins class=\"tocBtn is-fixed\" data-toc-id=\"js-tocBWGD\"><\/ins>\r\n\r\n\r\n\r\n\r\n<hr class=\"separator mt-3r\">\r\n\r\n\r\n\r\n\r\n<h2 class=\"fz-xl\">\u306a\u305c\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8\u3067\u306f\u30c0\u30e1\u306a\u306e\u304b<\/h2>\r\n<p>\u30dd\u30ab\u30e8\u30b1\u306e\u672c\u8cea\u306f\u3053\u3053\u306b\u3042\u308a\u307e\u3059\u3002<\/p>\r\n<blockquote>\r\n<p>\u30c0\u30d6\u30eb\u30c1\u30a7\u30c3\u30af\u3084\u30c1\u30a7\u30c3\u30af\u30b7\u30fc\u30c8\u306a\u3069\u3001\u5f93\u6765\u306e\u300c\u4eba\u306e\u610f\u8b58\u306b\u3060\u3051\u983c\u3063\u305f\u30df\u30b9\u9632\u6b62\u7b56\u300d\u3067\u3001\u591a\u304f\u306e\u30dd\u30ab\u3092\u9632\u3050\u3053\u3068\u306f\u3067\u304d\u306a\u3044\u3002<\/p>\r\n<\/blockquote>\r\n<p>\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8\u3084\u6307\u5dee\u3057\u78ba\u8a8d\u306f\u300c\u78ba\u8a8d\u3059\u308b\u3053\u3068\u300d\u81ea\u4f53\u3092\u30bf\u30b9\u30af\u3068\u3057\u3066\u4eba\u9593\u306b\u59d4\u306d\u3066\u3044\u307e\u3059\u3002\u75b2\u308c\u3066\u3044\u308b\u3068\u304d\u3001\u6025\u3044\u3067\u3044\u308b\u3068\u304d\u3001\u8907\u6570\u306e\u4f5c\u696d\u304c\u91cd\u306a\u3063\u3066\u3044\u308b\u3068\u304d\u2014\u2014\u305d\u3046\u3044\u3046\u72b6\u6cc1\u306e\u3068\u304d\u306b\u9650\u3063\u3066\u3001\u30df\u30b9\u306f\u8d77\u304d\u307e\u3059\u3002<\/p>\r\n<p>\u30dd\u30ab\u30e8\u30b1\u306e\u8003\u3048\u65b9\u306f\u3053\u3046\u3067\u3059\u3002<\/p>\r\n<ul style=\"list-style-type:bullet;\" class=\"my-0.5r\">\r\n<li>\u767a\u751f\u9632\u6b62\u306a\u305d\u3082\u305d\u3082\u30df\u30b9\u304c\u3067\u304d\u306a\u3044\u69cb\u9020\u3092\u4f5c\u308b<\/li>\r\n<li>\u6d41\u51fa\u9632\u6b62\u306a\u30df\u30b9\u304c\u8d77\u304d\u305f\u3068\u3057\u3066\u3082\u3001\u3059\u3050\u691c\u77e5\u3057\u3066\u901a\u77e5\u3059\u308b<\/li>\r\n<\/ul>\r\n<p>\u3053\u306e2\u3064\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001\u300c\u6c17\u3092\u3064\u3051\u3066\u3044\u306a\u304f\u3066\u3082\u5927\u4e08\u592b\u300d\u306a\u72b6\u614b\u3092\u76ee\u6307\u3057\u307e\u3059\u3002<\/p>\r\n\r\n<hr class=\"separator mt-3r\">\r\n\r\n<h2 class=\"fz-xl\">\u5b9f\u88c51\uff1a\u30c6\u30b9\u30c8\u30b5\u30a4\u30c8\u3068\u672c\u756a\u30b5\u30a4\u30c8\u3092\u8996\u899a\u7684\u306b\u533a\u5225\u3059\u308b\uff08AdminBar \u30ab\u30e9\u30fc\u30ea\u30f3\u30b0\uff09<\/h2>\r\n<p>WordPress \u306e\u7ba1\u7406\u30d0\u30fc\uff08AdminBar\uff09\u306e\u80cc\u666f\u8272\u306f\u3001<code>admin-style.php<\/code> \u3067\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3067\u304d\u307e\u3059\u3002URL\u306b <code>test<\/code> \u304c\u542b\u307e\u308c\u308b\u304b\u3069\u3046\u304b\u3067\u81ea\u52d5\u5224\u5b9a\u3057\u3001\u8272\u3092\u5207\u308a\u66ff\u3048\u307e\u3059\u3002<\/p>\r\n<pre><code class=\"language-php\">\/* admin-style.php *\/\r\nfunction dnone_styles() {\r\n  $is_test = strpos($_SERVER&lsqb;&#39;HTTP_HOST&#39;&rsqb;, &#39;test&#39;) !== false;\r\n  echo &#39;&lt;style&gt;&#39;;\r\n  if ($is_test) {\r\n    \/\/ \u30c6\u30b9\u30c8\u30b5\u30a4\u30c8\uff1a\u30b0\u30ec\u30fc\r\n    echo &#39;#wpadminbar { background: #666 !important; }&#39;;\r\n  } else {\r\n    \/\/ \u672c\u756a\u30b5\u30a4\u30c8\uff1a\u30c6\u30fc\u30de\u306e\u30d7\u30e9\u30a4\u30de\u30ea\u30ab\u30e9\u30fc\r\n    echo &#39;#wpadminbar { background: var(--color-primary) !important; }&#39;;\r\n  }\r\n  echo &#39;&lt;\/style&gt;&#39;;\r\n}\r\nadd_action(&#39;wp_head&#39;,    &#39;dnone_styles&#39;);\r\nadd_action(&#39;admin_head&#39;, &#39;dnone_styles&#39;);\r\n<\/code><\/pre>\r\n<p><b class=\"fw-600\">\u306a\u305c\u672c\u756a\u3092\u8d64\u30fb\u30c6\u30b9\u30c8\u3092\u7dd1\u306b\u3057\u306a\u3044\u306e\u304b\u3002<\/b> \u30d7\u30e9\u30a4\u30de\u30ea\u30ab\u30e9\u30fc\u304c\u7dd1\u306e\u30b5\u30a4\u30c8\u3082\u3042\u308c\u3070\u3001\u8d64\u306e\u30b5\u30a4\u30c8\u3082\u3042\u308a\u307e\u3059\u3002\u5168\u30b5\u30a4\u30c8\u3067\u8272\u306e\u610f\u5473\u3092\u7d71\u4e00\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u3001\u4eca\u5ea6\u306f\u300c\u3053\u306e\u8272\u306f\u4f55\u3092\u610f\u5473\u3059\u308b\u306e\u304b\u300d\u3092\u899a\u3048\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3002\u305d\u308c\u81ea\u4f53\u304c\u30df\u30b9\u306e\u6e29\u5e8a\u306b\u306a\u308a\u307e\u3059\u3002<b class=\"fw-600\">\u30b0\u30ec\u30fc = \u30c6\u30b9\u30c8\u74b0\u5883<\/b>\u3068\u3044\u30461\u3064\u306e\u30eb\u30fc\u30eb\u306b\u3059\u308b\u3053\u3068\u3067\u3001\u3069\u306e\u30b5\u30a4\u30c8\u3092\u958b\u3044\u3066\u3044\u3066\u3082\u300c\u30b0\u30ec\u30fc\u306a\u3089\u89e6\u3063\u3066\u3082\u5b89\u5168\u300d\u3068\u76f4\u611f\u7684\u306b\u5224\u65ad\u3067\u304d\u307e\u3059\u3002<\/p>\r\n\r\n<hr class=\"separator mt-3r\">\r\n\r\n<h2 class=\"fz-xl\">\u5b9f\u88c52\uff1a\u30c6\u30b9\u30c8\u30b5\u30a4\u30c8\u306e Noindex \u3092\u5f37\u5236\u4ed8\u4e0e\u3059\u308b<\/h2>\r\n<p>WordPress \u306e\u300c\u8a2d\u5b9a &gt; \u8868\u793a\u8a2d\u5b9a &gt; \u691c\u7d22\u30a8\u30f3\u30b8\u30f3\u304c\u30b5\u30a4\u30c8\u3092\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3057\u306a\u3044\u3088\u3046\u306b\u3059\u308b\u300d\u306f\u3001\u30c6\u30b9\u30c8\u30b5\u30a4\u30c8\u3067\u30aa\u30f3\u306b\u3057\u3066\u3044\u3066\u3082\u3001All in One Migration \u306a\u3069\u3067\u672c\u756a\u306b\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u305f\u969b\u306b\u305d\u306e\u307e\u307e\u30aa\u30f3\u306b\u306a\u3063\u3066\u3044\u308b\u304b\u78ba\u8a8d\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\r\n<p>\u3053\u308c\u3082\u300c\u78ba\u8a8d\u3059\u308b\u300d\u3068\u3044\u3046\u4eba\u9593\u306e\u30bf\u30b9\u30af\u306b\u4f9d\u5b58\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u69cb\u9020\u3067\u89e3\u6c7a\u3057\u307e\u3059\u3002<\/p>\r\n<pre><code class=\"language-php\">\/* \u30c6\u30b9\u30c8\u30b5\u30a4\u30c8\u3067\u306f\u5f37\u5236\u7684\u306b noindex \u3092\u4ed8\u4e0e *\/\r\nfunction force_noindex_on_test() {\r\n  $is_test = strpos($_SERVER&lsqb;&#39;HTTP_HOST&#39;&rsqb;, &#39;test&#39;) !== false;\r\n  if ($is_test) {\r\n    echo &#39;&lt;meta name=&quot;robots&quot; content=&quot;noindex, nofollow&quot; \/&gt;&#39; . &quot;n&quot;;\r\n  }\r\n}\r\nadd_action(&#39;wp_head&#39;, &#39;force_noindex_on_test&#39;, 1);\r\n<\/code><\/pre>\r\n<p><code>priority: 1<\/code> \u306b\u3059\u308b\u3053\u3068\u3067\u3001\u30d7\u30e9\u30b0\u30a4\u30f3\u304c\u51fa\u529b\u3059\u308b\u3069\u306e robots \u30e1\u30bf\u3088\u308a\u3082\u5148\u306b\u633f\u5165\u3055\u308c\u307e\u3059\u3002URL\u306b <code>test<\/code> \u304c\u542b\u307e\u308c\u308b\u9650\u308a\u3001WordPress\u306e\u8a2d\u5b9a\u304c\u3069\u3046\u306a\u3063\u3066\u3044\u3088\u3046\u3068\u5fc5\u305a noindex \u306b\u306a\u308a\u307e\u3059\u3002<\/p>\r\n<p>\u3042\u308f\u305b\u3066\u3001<code>&lt;title&gt;<\/code> \u30bf\u30b0\u306b\u3082 <code>&lsqb;\u30c6\u30b9\u30c8&rsqb;<\/code> \u3092\u81ea\u52d5\u4ed8\u4e0e\u3057\u307e\u3059\u3002<\/p>\r\n<pre><code class=\"language-php\">\/* &lt;title&gt; \u306b &lsqb;\u30c6\u30b9\u30c8&rsqb; \u3092\u4ed8\u4e0e *\/\r\nfunction add_test_prefix_to_title($title_parts) {\r\n  $is_test = strpos($_SERVER&lsqb;&#39;HTTP_HOST&#39;&rsqb;, &#39;test&#39;) !== false;\r\n  if ($is_test &amp;&amp; isset($title_parts&lsqb;&#39;title&#39;&rsqb;)) {\r\n    $title_parts&lsqb;&#39;title&#39;&rsqb; = &#39;&lsqb;\u30c6\u30b9\u30c8&rsqb; &#39; . $title_parts&lsqb;&#39;title&#39;&rsqb;;\r\n  }\r\n  return $title_parts;\r\n}\r\nadd_filter(&#39;document_title_parts&#39;, &#39;add_test_prefix_to_title&#39;);\r\n\r\n\/* \u7ba1\u7406\u30d0\u30fc\u306e\u30b5\u30a4\u30c8\u540d\u306b\u3082 &lsqb;\u30c6\u30b9\u30c8&rsqb; \u3092\u4ed8\u4e0e *\/\r\nfunction add_test_prefix_to_adminbar($wp_admin_bar) {\r\n  $is_test = strpos($_SERVER&lsqb;&#39;HTTP_HOST&#39;&rsqb;, &#39;test&#39;) !== false;\r\n  if ($is_test) {\r\n    $node = $wp_admin_bar-&gt;get_node(&#39;site-name&#39;);\r\n    if ($node) {\r\n      $node-&gt;title = &#39;&lsqb;\u30c6\u30b9\u30c8&rsqb; &#39; . $node-&gt;title;\r\n      $wp_admin_bar-&gt;add_node((array)$node);\r\n    }\r\n  }\r\n}\r\nadd_action(&#39;admin_bar_menu&#39;, &#39;add_test_prefix_to_adminbar&#39;, 999);\r\n<\/code><\/pre>\r\n<p>\u30d6\u30e9\u30a6\u30b6\u306e\u30bf\u30d6\u30fb\u7ba1\u7406\u30d0\u30fc\u30fb\u30da\u30fc\u30b8\u30bf\u30a4\u30c8\u30eb\u306e\u3059\u3079\u3066\u306b <code>&lsqb;\u30c6\u30b9\u30c8&rsqb;<\/code> \u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3001\u3069\u3053\u3092\u898b\u3066\u3082\u300c\u4eca\u30c6\u30b9\u30c8\u74b0\u5883\u3092\u89e6\u3063\u3066\u3044\u308b\u300d\u3068\u8a8d\u8b58\u3067\u304d\u307e\u3059\u3002<\/p>\r\n\r\n<hr class=\"separator mt-3r\">\r\n\r\n<h2 class=\"fz-xl\">\u5b9f\u88c53\uff1a\u30a2\u30ca\u30ea\u30c6\u30a3\u30af\u30b9\u30bf\u30b0\u3092\u30c6\u30fc\u30de\u5916\u306b\u7f6e\u304f<\/h2>\r\n<p>WordPress \u306e\u30c6\u30fc\u30de\u30d5\u30a1\u30a4\u30eb\u3084\u30d7\u30e9\u30b0\u30a4\u30f3\u8a2d\u5b9a\u306b GA4 \u30bf\u30b0\u3092\u7f6e\u304f\u3068\u3001All in One Migration \u3067\u30c6\u30fc\u30de\u3054\u3068\u672c\u756a\u306b\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u305f\u3068\u304d\u3001\u30c6\u30b9\u30c8\u74b0\u5883\u306e\u8a2d\u5b9a\u304c\u6df7\u5165\u3059\u308b\u30ea\u30b9\u30af\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\r\n<p>\u89e3\u6c7a\u7b56\u306f\u3001\u30a2\u30ca\u30ea\u30c6\u30a3\u30af\u30b9\u30bf\u30b0\u3092<b class=\"fw-600\">\u30b5\u30a4\u30c8\u306e\u30eb\u30fc\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea<\/b>\u306b\u7f6e\u304d\u3001\u30c6\u30fc\u30de\u304b\u3089\u306f\u30d1\u30b9\u3092\u53c2\u7167\u3059\u308b\u3060\u3051\u306b\u3059\u308b\u3053\u3068\u3067\u3059\u3002<\/p>\r\n<pre><code class=\"language-\">\/\uff08\u30b5\u30fc\u30d0\u30fc\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30eb\u30fc\u30c8\uff09\r\n\u2514\u2500\u2500 site_root\/\r\n    \u251c\u2500\u2500 analytics-head.php   \u2190 \u3053\u3053\u306b GA4\u30fbGTM \u30bf\u30b0\u3092\u66f8\u304f\r\n    \u251c\u2500\u2500 analytics-body.php\r\n    \u251c\u2500\u2500 analytics-foot.php\r\n    \u2514\u2500\u2500 wp-content\/ \u2190 WordPress \u672c\u4f53\r\n        \u2514\u2500\u2500 themes\/\r\n            \u2514\u2500\u2500 zaratan\/ \u2190 \u30c6\u30fc\u30de\uff08Migration \u3067\u6301\u3061\u904b\u3076\u7bc4\u56f2\uff09\r\n<\/code><\/pre>\r\n<p>\u30c6\u30fc\u30de\u306e <code>head.php<\/code> \u304b\u3089\u306e\u547c\u3073\u51fa\u3057\u306f\u3053\u3046\u3067\u3059\u3002<\/p>\r\n<pre><code class=\"language-php\">&lt;?php\r\n$_f = do_shortcode(&#39;&lsqb;root_sitepath&rsqb;&#39;) . &#39;\/analytics-head.php&#39;;\r\nif (file_exists($_f)) include $_f;\r\n?&gt;\r\n<\/code><\/pre>\r\n<p><code>file_exists()<\/code> \u3067\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u30d5\u30a1\u30a4\u30eb\u304c\u306a\u304f\u3066\u3082\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u305b\u3093\u3002<\/p>\r\n<p><b class=\"fw-600\">\u3053\u306e\u30a2\u30d7\u30ed\u30fc\u30c1\u306e\u5229\u70b9\uff1a<\/b><\/p>\r\n<ul style=\"list-style-type:bullet;\" class=\"my-0.5r\">\r\n<li>All in One Migration \u3067\u30c6\u30fc\u30de\u3092\u4e38\u3054\u3068\u79fb\u52d5\u3055\u305b\u3066\u3082\u3001\u30eb\u30fc\u30c8\u306e <code>analytics-*.php<\/code> \u306b\u306f\u89e6\u308c\u306a\u3044<\/li>\r\n<li>\u30c6\u30b9\u30c8\u30b5\u30fc\u30d0\u30fc\u306b\u306f <code>analytics-*.php<\/code> \u3092\u7f6e\u304b\u306a\u3044\u3060\u3051\u3067\u3001\u30bf\u30b0\u304c\u51fa\u529b\u3055\u308c\u306a\u3044<\/li>\r\n<li>\u30d5\u30a1\u30a4\u30eb\u3092\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u4f5c\u696d\u306f\u516c\u958b\u6642\u306e1\u56de\u3060\u3051\u3067\u3001\u305d\u306e\u5f8c\u89e6\u308b\u5fc5\u8981\u304c\u306a\u3044<\/li>\r\n<\/ul>\r\n\r\n<hr class=\"separator mt-3r\">\r\n\r\n<h2 class=\"fz-xl\">\u5b9f\u88c54\uff1a\u8a2d\u5b9a\u306e\u5909\u66f4\u3057\u5fd8\u308c\u30921\u7b87\u6240\u306b\u96c6\u7d04\u3059\u308b<\/h2>\r\n<p>\u8907\u6570\u30b5\u30a4\u30c8\u3092\u7ba1\u7406\u3059\u308b\u3068\u304d\u3001\u300c\u3053\u306e\u30b5\u30a4\u30c8\u306e\u30eb\u30fc\u30c8\u30d1\u30b9\u306f\u3069\u3053\u304b\u300d\u3068\u3044\u3046\u60c5\u5831\u304c\u3042\u3061\u3053\u3061\u306b\u6563\u3089\u3070\u3063\u3066\u3044\u308b\u3068\u3001\u5909\u66f4\u6f0f\u308c\u304c\u8d77\u304d\u307e\u3059\u3002<\/p>\r\n<p><code>shortcodes.php<\/code> \u306b\u30d1\u30b9\u8a2d\u5b9a\u3092\u96c6\u7d04\u3057\u3001\u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\u3068\u3057\u3066\u547c\u3073\u51fa\u305b\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\r\n<pre><code class=\"language-php\">\/* shortcodes.php *\/\r\n$root_path      = $_SERVER&lsqb;&#39;DOCUMENT_ROOT&#39;&rsqb;;\r\n$root_sitepath  = $root_path . &#39;\/site_root&#39;;   \/\/ \u2190 \u3053\u3053\u3060\u3051\u5909\u3048\u308b\r\n$root_themepath = $root_sitepath . &#39;\/wp-content\/themes\/zaratan&#39;;\r\n\r\n$paths = &lsqb;\r\n  &#39;root_sitepath&#39;  =&gt; $root_sitepath,\r\n  &#39;root_themepath&#39; =&gt; $root_themepath,\r\n  \/\/ ...\r\n&rsqb;;\r\n<\/code><\/pre>\r\n<p>\u9ad8\u5929\u539f\u30b5\u30a4\u30c8\u306a\u3089 <code>&#39;\/takamagahara&#39;<\/code> \u306b\u5909\u3048\u308b\u3060\u3051\u3067\u3059\u3002\u30c6\u30fc\u30de\u306e\u547c\u3073\u51fa\u3057\u5074\u306f\u4e00\u5207\u5909\u66f4\u4e0d\u8981\u3002\u300c\u5909\u66f4\u304c1\u304b\u6240\u3060\u3051\u300d\u3068\u3044\u3046\u306e\u306f\u30dd\u30ab\u30e8\u30b1\u306e\u57fa\u672c\u539f\u5247\u306e\u3072\u3068\u3064\u3067\u3059\u3002<\/p>\r\n\r\n<hr class=\"separator mt-3r\">\r\n\r\n<h2 class=\"fz-xl\">\u5b9f\u88c55\uff1a\u30a2\u30af\u30bb\u30b9\u7570\u5e38\u3092\u81ea\u52d5\u691c\u77e5\u3057\u3066\u30e1\u30fc\u30eb\u3067\u901a\u77e5\u3059\u308b\uff08GAS\uff09<\/h2>\r\n<p>\u767a\u751f\u9632\u6b62\u306e\u4ed5\u7d44\u307f\u3092\u3044\u304f\u3089\u6574\u3048\u3066\u3082\u3001\u60f3\u5b9a\u5916\u306e\u30df\u30b9\u306f\u30bc\u30ed\u306b\u306f\u306a\u308a\u307e\u305b\u3093\u3002\u305d\u3053\u3067<b class=\"fw-600\">\u6d41\u51fa\u9632\u6b62<\/b>\u3068\u3057\u3066\u3001Google Apps Script\uff08GAS\uff09\u3067 GA4 \u306e\u30a2\u30af\u30bb\u30b9\u6570\u3092\u6bce\u671d\u30c1\u30a7\u30c3\u30af\u3057\u3001\u7570\u5e38\u304c\u3042\u308c\u3070\u30a2\u30e9\u30fc\u30c8\u30e1\u30fc\u30eb\u3092\u9001\u308b\u4ed5\u7d44\u307f\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\r\n<p>\u5224\u5b9a\u30ed\u30b8\u30c3\u30af\u306f2\u3064\u3067\u3059\u3002<\/p>\r\n<ul style=\"list-style-type:bullet;\" class=\"my-0.5r\">\r\n<li>\u524d\u65e5\u6bd4\u306a\u4e00\u6628\u65e5\u3068\u6bd4\u3079\u3066 \u221240% \u4ee5\u4e0b<\/li>\r\n<li>\u76f4\u8fd17\u65e5\u5e73\u5747\u6bd4\u306a\u904e\u53bb7\u65e5\u306e\u5e73\u5747\u3068\u6bd4\u3079\u3066 \u221240% \u4ee5\u4e0b<\/li>\r\n<\/ul>\r\n<pre><code class=\"language-javascript\">const CONFIG = {\r\n  REPORT_TO: &#39;your@email.com&#39;,\r\n  GA_PROPERTIES: &lsqb;\r\n    { label: &#39;\u30b5\u30a4\u30c8A&#39;, propertyId: &#39;000000000&#39; },\r\n    { label: &#39;\u30b5\u30a4\u30c8B&#39;, propertyId: &#39;111111111&#39; },\r\n  &rsqb;,\r\n  ALERT_THRESHOLD: 0.4,  \/\/ 40%\u6e1b\u3067\u30a2\u30e9\u30fc\u30c8\r\n  BASELINE_DAYS: 7,\r\n};\r\n<\/code><\/pre>\r\n<p><code>GA_PROPERTIES<\/code> \u306b\u30b5\u30a4\u30c8\u3092\u8ffd\u52a0\u3059\u308b\u3060\u3051\u3067\u8907\u6570\u30b5\u30a4\u30c8\u30921\u901a\u306e\u30e1\u30fc\u30eb\u3067\u7ba1\u7406\u3067\u304d\u307e\u3059\u3002\u30a2\u30af\u30bb\u30b9\u304c\u6b63\u5e38\u306a\u3068\u304d\u306f <code>\u2705 GA4 \u30c7\u30a4\u30ea\u30fc\u30ec\u30dd\u30fc\u30c8<\/code>\u3001\u6025\u843d\u3057\u305f\u3068\u304d\u306f <code>\u26a0\ufe0f\u3010\u8981\u78ba\u8a8d\u3011GA4 \u30a2\u30af\u30bb\u30b9\u7570\u5e38\u691c\u77e5<\/code> \u3068\u4ef6\u540d\u304c\u5909\u308f\u308a\u307e\u3059\u3002<\/p>\r\n<p>\u4ef6\u540d\u3060\u3051\u3067\u5224\u65ad\u3067\u304d\u308b\u306e\u3067\u3001\u6bce\u65e5\u30e1\u30fc\u30eb\u3092\u958b\u3044\u3066\u6570\u5024\u3092\u78ba\u8a8d\u3059\u308b\u30b3\u30b9\u30c8\u304c\u304b\u304b\u308a\u307e\u305b\u3093\u3002<\/p>\r\n<p>\u8a73\u3057\u3044\u8a2d\u5b9a\u624b\u9806\u306b\u3064\u3044\u3066\u306f\u3001\u5225\u8a18\u4e8b\u300c<cite><a href=\"https:\/\/code-plus.jp\/gp\/ga4report-gas-11808\/\" target=\"_blank\" class=\"link\">GA4\u306e\u30ec\u30dd\u30fc\u30c8\u3092\u6bce\u65e5\u81ea\u52d5\u3067\u30e1\u30fc\u30eb\u914d\u4fe1\u3059\u308b\u65b9\u6cd5\u3010GAS\u3067\u7570\u5e38\u5024\u30a2\u30e9\u30fc\u30c8\u4ed8\u304d\u3011<\/a><\/cite>\u300d\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\r\n\r\n<a href=\"https:\/\/code-plus.jp\/gp\/ga4report-gas-11808\/\" class=\"linkbox my-1.5r\">\r\n<h4 class=\"linkbox-title fz-md\">GA4\u30ec\u30dd\u30fc\u30c8\u3092\u6bce\u65e5\u81ea\u52d5\u30e1\u30fc\u30eb\u914d\u4fe1\u3059\u308b\u65b9\u6cd5\u3010GAS\u3067\u7570\u5e38\u5024\u30a2\u30e9\u30fc\u30c8\u4ed8\u304d\u3011<\/h4>\r\n\r\n<span class=\"linkbox-excerpt\">Google Apps Script\uff08GAS\uff09\u3067GA4\u306e\u30a2\u30af\u30c6\u30a3\u30d6\u30e6\u30fc\u30b6\u30fc\u6570\u30fbPV\u6570\u3092\u6bce\u671d\u81ea\u52d5\u30e1\u30fc\u30eb\u914d\u4fe1\u3059\u308b\u65b9\u6cd5\u3092\u89e3\u8aac\u3002\u524d\u65e5\u6bd4\u30fb7\u65e5\u5e73\u5747\u6bd4\u3067\u30a2\u30af\u30bb\u30b9\u304c\u6025\u843d\u3057\u305f\u3068\u304d\u4ef6\u540d\u3067\u901a\u77e5\u3059\u308b\u7570\u5e38\u5024\u30a2\u30e9\u30fc\u30c8\u6a5f\u80fd\u4ed8\u304d\u3002\u8907\u6570\u30b5\u30a4\u30c8\u5bfe\u5fdc\u3002\r\n&emsp;<u class=\"linkbox-more\">\u7d9a\u304d\u3092\u8aad\u3080<\/u>\r\n<\/span>\r\n<\/a>\r\n\r\n<hr class=\"separator mt-3r\">\r\n\r\n<h2 class=\"fz-xl\">3\u3064\u306e\u30ec\u30a4\u30e4\u30fc\u3067\u591a\u5c64\u9632\u5fa1\u3059\u308b<\/h2>\r\n<p>\u30dd\u30ab\u30e8\u30b1\u306e\u5b9f\u88c5\u3092\u6574\u7406\u3059\u308b\u3068\u30013\u3064\u306e\u30ec\u30a4\u30e4\u30fc\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\r\n<table class=\"table my-0.5r\">\r\n  <thead>\r\n  <tr class=\"rung\">\r\n    <th>\u30ec\u30a4\u30e4\u30fc<\/th>\r\n    <td>\u5b9f\u88c5\u5185\u5bb9<\/td>\r\n    <td>\u76ee\u7684<\/td>\r\n  <\/tr>\r\n<\/thead><tbody>\r\n<tr class=\"rung\">\r\n  <th><b class=\"fw-600\">\u8996\u899a\u7684\u306b\u6c17\u3065\u304b\u305b\u308b<\/b><\/th>\r\n  <td>AdminBar\u306e\u8272\u5206\u3051 \/ <code>&lsqb;\u30c6\u30b9\u30c8&rsqb;<\/code> \u8868\u793a<\/td>\r\n  <td>\u4eca\u3069\u306e\u74b0\u5883\u306b\u3044\u308b\u304b\u5e38\u306b\u610f\u8b58\u3055\u305b\u308b<\/td>\r\n<\/tr><tr class=\"rung\">\r\n<th><b class=\"fw-600\">\u7269\u7406\u7684\u306b\u30df\u30b9\u3067\u304d\u306a\u3044\u69cb\u9020<\/b><\/th>\r\n<td>\u30eb\u30fc\u30c8\u3078\u306e\u30bf\u30b0\u914d\u7f6e \/ <code>$root_sitepath<\/code> \u96c6\u7d04 \/ \u5f37\u5236 noindex<\/td>\r\n<td>\u30df\u30b9\u304c\u8d77\u3053\u308b\u4f59\u5730\u3092\u306a\u304f\u3059<\/td>\r\n<\/tr><tr class=\"rung\">\r\n<th><b class=\"fw-600\">\u81ea\u52d5\u691c\u77e5\u30fb\u901a\u77e5<\/b><\/th>\r\n<td>GAS \u30c7\u30a4\u30ea\u30fc\u30ec\u30dd\u30fc\u30c8\uff0b\u30a2\u30e9\u30fc\u30c8<\/td>\r\n<td>\u6f0f\u308c\u305f\u30df\u30b9\u3092\u65e9\u671f\u767a\u898b\u3059\u308b<\/td>\r\n<\/tr>\r\n<\/tbody><\/table>\r\n<p>1\u3064\u306e\u9632\u5fa1\u306b\u983c\u308b\u306e\u3067\u306f\u306a\u304f\u3001\u3053\u308c\u3089\u304c\u7d44\u307f\u5408\u308f\u3055\u308b\u3053\u3068\u3067\u5b9f\u52b9\u6027\u304c\u4e0a\u304c\u308a\u307e\u3059\u3002<\/p>\r\n\r\n<hr class=\"separator mt-3r\">\r\n\r\n<h2 class=\"fz-xl\">\u307e\u3068\u3081<\/h2>\r\n<p>\u300c\u6b21\u304b\u3089\u6c17\u3092\u3064\u3051\u308b\u300d\u300c\u6bce\u56de\u78ba\u8a8d\u3059\u308b\u300d\u3068\u3044\u3046\u30a2\u30d7\u30ed\u30fc\u30c1\u306b\u306f\u3001\u6839\u672c\u7684\u306a\u9650\u754c\u304c\u3042\u308a\u307e\u3059\u3002\u4eba\u9593\u306f\u96c6\u4e2d\u529b\u304c\u6301\u7d9a\u305b\u305a\u3001\u7e70\u308a\u8fd4\u3057\u4f5c\u696d\u3092\u98fd\u304d\u308b\u751f\u304d\u7269\u3060\u304b\u3089\u3067\u3059\u3002<\/p>\r\n<p>\u30dd\u30ab\u30e8\u30b1\u306e\u8003\u3048\u65b9\u306f\u300c\u30df\u30b9\u3092\u3059\u308b\u4eba\u9593\u304c\u60aa\u3044\u300d\u3067\u306f\u306a\u304f\u300c\u30df\u30b9\u304c\u8d77\u304d\u3084\u3059\u3044\u69cb\u9020\u304c\u60aa\u3044\u300d\u3068\u3044\u3046\u8996\u70b9\u304b\u3089\u51fa\u767a\u3057\u307e\u3059\u3002<b class=\"fw-600\">\u69cb\u9020\u3092\u5909\u3048\u3066\u3057\u307e\u3048\u3070\u3001\u6ce8\u610f\u529b\u306b\u95a2\u4fc2\u306a\u304f\u6b63\u3057\u3044\u7d50\u679c\u304c\u5f97\u3089\u308c\u308b<\/b>\u2014\u2014\u3053\u308c\u304c\u672c\u8cea\u3067\u3059\u3002<\/p>\r\n<p>\u4eca\u56de\u7d39\u4ecb\u3057\u305f\u5b9f\u88c5\u306e\u307b\u3068\u3093\u3069\u306f\u3001\u4e00\u5ea6\u8a2d\u5b9a\u3057\u3066\u3057\u307e\u3048\u3070\u305d\u306e\u5f8c\u89e6\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u305b\u3093\u3002\u305d\u306e\u3053\u3068\u81ea\u4f53\u304c\u3001\u512a\u308c\u305f\u30dd\u30ab\u30e8\u30b1\u306e\u8a2d\u8a08\u306e\u8a3c\u660e\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>","protected":false},"excerpt":{"rendered":"\u30a2\u30ca\u30ea\u30c6\u30a3\u30af\u30b9\u30bf\u30b0\u6f0f\u308c\u30fbNoindex\u8a2d\u5b9a\u30df\u30b9\u306a\u3069\u3001WordPress\u306e\u904b\u7528\u3067\u3088\u304f\u3042\u308b\u30b1\u30a2\u30ec\u30b9\u30df\u30b9\u3092\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8\u3067\u306f\u306a\u304f\u300c\u4ed5\u7d44\u307f\u300d\u3067\u9632\u3050\u65b9\u6cd5\u3092\u89e3\u8aac\u3002AdminBar\u306e\u8272\u5206\u3051\u30fb\u5f37\u5236noindex\u30fbGAS\u306b\u3088\u308b\u81ea\u52d5\u30a2\u30e9\u30fc\u30c8\u306a\u3069\u5177\u4f53\u7684\u306a\u5b9f\u88c5\u4ed8\u304d\u3002","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","footnotes":"","vk-ltc-link":"","vk-ltc-target":"0"},"categories":[13],"tags":[856,854,855,861,857,858,859,860,851,847,224,148,149,102],"group":[],"pg":[],"class_list":["post-11876","post","type-post","status-publish","format-standard","category-wordpress","tag-856","tag-854","tag-855","tag-noindex","tag-admin-style-php","tag-858","tag-859","tag-all-in-one-migration","tag-gtm","tag-gas","tag-224","tag-google-analytics","tag-ga4","tag-wordpress"],"acf":[],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/11876","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=11876"}],"version-history":[{"count":0,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/11876\/revisions"}],"wp:attachment":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media?parent=11876"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/categories?post=11876"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/tags?post=11876"},{"taxonomy":"group","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/group?post=11876"},{"taxonomy":"pg","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/pg?post=11876"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}