{"id":11413,"date":"2026-03-17T18:11:50","date_gmt":"2026-03-17T09:11:50","guid":{"rendered":"https:\/\/code-plus.jp\/gp\/?p=11413"},"modified":"2026-03-17T18:35:33","modified_gmt":"2026-03-17T09:35:33","slug":"php8-fatalerror-11413","status":"publish","type":"post","link":"https:\/\/code-plus.jp\/gp\/php8-fatalerror-11413\/","title":{"rendered":"WordPress\u30c6\u30fc\u30de\u306eFatal Error\u3068\u30a8\u30e9\u30fc\u306e\u9023\u9396\u69cb\u9020\u3092\u76f4\u3059\u3010PHP7\u2192PHP8\u79fb\u884c\u3011"},"content":{"rendered":"<!--\r\ntitle: WordPress\u30c6\u30fc\u30de\u306eFatal Error\u3068\u30a8\u30e9\u30fc\u306e\u9023\u9396\u69cb\u9020\u3092\u76f4\u3059\u3010PHP7\u2192PHP8\u79fb\u884c\u3011\r\ndescription: PHP8\u79fb\u884c\u5f8c\u306bWordPress\u304c\u771f\u3063\u767d\u306b\u306a\u308bFatal Error\u306e\u539f\u56e0\u3068\u4fee\u6b63\u65b9\u6cd5\u3092\u5b9f\u4f8b\u3067\u89e3\u8aac\u3002get_page_by_path()\u3078\u306e\u914d\u5217\u6e21\u3057\u554f\u984c\u3001include\u306e\u5931\u6557\u304csession_start\u30a8\u30e9\u30fc\u3092\u5f15\u304d\u8d77\u3053\u3059\u9023\u9396\u69cb\u9020\u306e\u3057\u304f\u307f\u3001\u30c6\u30fc\u30de\u8907\u88fd\u6642\u306b\u8d77\u304d\u3084\u3059\u3044\u30d5\u30a1\u30a4\u30eb\u540d\u30fb\u30d1\u30b9\u30fb\u5909\u6570\u5b9a\u7fa9\u306e\u66f4\u65b0\u6f0f\u308c\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8\u3082\u307e\u3068\u3081\u3066\u3044\u307e\u3059\u3002\r\ntags: PHP, PHP8, WordPress, Fatal Error, session_start, get_page_by_path, \u30c6\u30fc\u30de\u8907\u88fd, PHP\u30a8\u30e9\u30fc, WordPress\u79fb\u884c, functions.php\r\n-->\r\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001<b class=\"bold\">\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u591a\u304f\u306e\u6b62\u307e\u308b Fatal Error<\/b> \u3068\u3001<b class=\"bold\">1\u3064\u306e\u30a8\u30e9\u30fc\u304c\u5225\u306e\u30a8\u30e9\u30fc\u3092\u5f15\u304d\u8d77\u3053\u3059\u9023\u9396\u69cb\u9020<\/b> \u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u307e\u3059\u3002<br \/>\r\n\u6700\u5f8c\u306b\u3001\u30c6\u30fc\u30de\u3092\u8907\u88fd\u3057\u3066\u4f5c\u3063\u305f\u5834\u5408\u306b\u8d77\u304d\u3084\u3059\u3044\u300c\u66f4\u65b0\u6f0f\u308c\u300d\u306e\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8\u3082\u307e\u3068\u3081\u307e\u3059\u3002<\/p>\r\n\r\n<a href=\"https:\/\/code-plus.jp\/gp\/php8-warning-11409\/\" class=\"linkbox my-1.5r\">\r\n<h4 class=\"linkbox-title fz-md\">PHP8\u79fb\u884c\u3067WordPress\u30c6\u30fc\u30de\u306b\u51fa\u308bWarning 5\u30d1\u30bf\u30fc\u30f3\u3068\u4fee\u6b63\u30b3\u30fc\u30c9\u3010\u5b9f\u4f8b\u4ed8\u304d\u3011<\/h4>\r\n<picture class=\"linkbox-thumbnail\">\r\n<img decoding=\"async\" width=\"300\" height=\"200\" src=\"https:\/\/code-plus.jp\/gp\/wp-content\/uploads\/7d1dec178674388d0e81629e134794f6.jpg?ver=20260317183533\" alt=\"PHP8\u79fb\u884c\u3067WordPress\u30c6\u30fc\u30de\u306b\u51fa\u308bWarning 5\u30d1\u30bf\u30fc\u30f3\u3068\u4fee\u6b63\u30b3\u30fc\u30c9\u3010\u5b9f\u4f8b\u4ed8\u304d\u3011\" loading=\"lazy\" \/>\r\n<\/picture>\r\n<span class=\"linkbox-excerpt\">PHP7\u2192PHP8\u3078\u306e\u79fb\u884c\u5f8c\u306bWordPress\u30c6\u30fc\u30de\u3067\u5b9f\u969b\u306b\u767a\u751f\u3057\u305fPHP Warning 5\u7a2e\u985e\u3092\u3001before\/after\u306e\u30b3\u30fc\u30c9\u4ed8\u304d\u3067\u89e3\u8aac\u3002$post\u306enull\u30c1\u30a7\u30c3\u30af\u30fbget_post_meta()\u306efalse\u5bfe\u5fdc\u30fbforeach\u306enull\u5f15\u6570\u30fb$_...\r\n&emsp;<u class=\"linkbox-more\">\u7d9a\u304d\u3092\u8aad\u3080<\/u>\r\n<\/span>\r\n<\/a>\r\n\r\n<!-- \u2605\u76ee\u6b21\u30ea\u30b9\u30c8 -->\r\n<ul class=\"tocList mt-1r\" data-toc-id=\"js-tocBWGD\"><\/ul>\r\n<ins class=\"tocBtn is-fixed\" data-toc-id=\"js-tocBWGD\"><\/ins>\r\n<!-- \u76ee\u6b21\uff1aJS -->\r\n<script src=\"https:\/\/code-plus.jp\/cdn\/js\/_gimmicks\/inppend-tocList.js\"><\/script>\r\n<script src=\"https:\/\/code-plus.jp\/cdn\/js\/_gimmicks\/inppend-tocBtn.js\"><\/script>\r\n\r\n\r\n\r\n\r\n<hr class=\"separator mt-3r\">\r\n\r\n<h2 class=\"fz-xl\">Fatal Error\uff1a<code>get_page_by_path()<\/code> \u306b\u914d\u5217\u3092\u6e21\u3057\u3066\u3057\u307e\u3046\u554f\u984c<\/h2>\r\n<p class=\"mt-1r\"><b class=\"bold\">\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8<\/b>\r\n<pre><code class=\"language-\">PHP Fatal error: Uncaught TypeError: urldecode(): Argument #1 ($string) must be of type string, array given in functions.php on line 361\r\n<\/code><\/pre>\r\n<p class=\"mt-1r\"><b class=\"bold\">\u72b6\u6cc1<\/b>\r\n<p>\u672c\u756a\u30b5\u30fc\u30d0\u30fc\u306b\u30c7\u30d7\u30ed\u30a4\u3057\u305f\u3042\u3068\u3001\u30b5\u30a4\u30c8\u304c\u771f\u3063\u767d\u306b\u306a\u3063\u3066\u767a\u899a\u3059\u308b\u30b1\u30fc\u30b9\u3067\u3059\u3002<\/p>\r\n<p><code>analytics.php<\/code> \u306a\u3069\u306e\u5171\u901a\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u304b\u3089\u3001\u6b21\u306e\u3088\u3046\u306b\u95a2\u6570\u3092\u547c\u3093\u3067\u3044\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\r\n<pre><code class=\"language-php\">\/\/ analytics.php\uff08\u5171\u901a\u30d5\u30a1\u30a4\u30eb\uff09\r\nif (page_is_ancestor_of(array(&#39;request&#39;, &#39;consult&#39;))) {\r\n    \/\/ Google\u30a2\u30ca\u30ea\u30c6\u30a3\u30af\u30b9\u306e\u30a4\u30d9\u30f3\u30c8\u8a08\u6e2c\u30b3\u30fc\u30c9\u306a\u3069\r\n}\r\n<\/code><\/pre>\r\n<p>\u300c<code>request<\/code> \u307e\u305f\u306f <code>consult<\/code> \u306e\u3069\u3061\u3089\u304b\u304cURL\u306e\u7956\u5148\u306a\u3089\u300d\u3068\u3044\u3046\u610f\u56f3\u3067\u3001\u914d\u5217\u3067\u6e21\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\r\n\r\n<p class=\"mt-1r\"><b class=\"bold\">\u306a\u305cPHP8\u3067Fatal Error\u306b\u306a\u308b\u304b<\/b>\r\n<p><code>page_is_ancestor_of()<\/code> \u306ffunctions.php\u3067\u5b9a\u7fa9\u3057\u305f\u30ab\u30b9\u30bf\u30e0\u95a2\u6570\u3067\u3001\u5185\u90e8\u3067 <code>get_page_by_path()<\/code> \u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\r\n<pre><code class=\"language-php\">function page_is_ancestor_of($slug) {\r\n    $page = get_page_by_path($slug);  \/\/ \u3053\u3053\u306b\u914d\u5217\u304c\u6e21\u308b\r\n    \/\/ ...\r\n}\r\n<\/code><\/pre>\r\n<p><code>get_page_by_path()<\/code> \u306f <b class=\"bold\">\u6587\u5b57\u5217\u306e\u30b9\u30e9\u30c3\u30b0<\/b> \u3092\u53d7\u3051\u53d6\u308b\u95a2\u6570\u3067\u3059\u3002PHP7.x\u3067\u306f\u914d\u5217\u3092\u6e21\u3057\u3066\u3082\u5185\u90e8\u3067\u6697\u9ed9\u7684\u306b\u6587\u5b57\u5217\u5909\u63db\u3055\u308c\u3066\u52d5\u4f5c\u3057\u3066\u3044\u307e\u3057\u305f\u304c\u3001PHP8.x\u3067\u306f <code>urldecode()<\/code> \u304c\u53b3\u5bc6\u306a\u578b\u30c1\u30a7\u30c3\u30af\u3092\u884c\u3046\u3088\u3046\u306b\u306a\u308a\u3001<b class=\"bold\">\u914d\u5217\u3092\u6e21\u3059\u3068Fatal Error<\/b> \u306b\u306a\u308a\u307e\u3059\u3002<\/p>\r\n<h3 class=\"fz-ml\">\u4fee\u6b63\u65b9\u6cd5<\/h3>\r\n<p>\u547c\u3073\u51fa\u3057\u5074\uff08analytics.php\uff09\u306f<b class=\"bold\">\u5171\u901a\u30d5\u30a1\u30a4\u30eb\u306a\u306e\u3067\u5909\u66f4\u3057\u305f\u304f\u306a\u3044<\/b>\u3068\u3044\u3046\u30b1\u30fc\u30b9\u304c\u591a\u3044\u3067\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u95a2\u6570\u5074\uff08functions.php\uff09\u3092\u914d\u5217\u306b\u3082\u5bfe\u5fdc\u3067\u304d\u308b\u3088\u3046\u62e1\u5f35\u3057\u307e\u3059\u3002<\/p>\r\n<pre><code class=\"language-php\">\/\/ functions.php\uff08Before\uff09\r\nfunction page_is_ancestor_of($slug) {\r\n    $queried = get_queried_object();\r\n    $page = get_page_by_path($slug);\r\n    if (!$page) return false;\r\n    return ($queried instanceof WP_Post &amp;&amp; $queried-&gt;post_parent == $page-&gt;ID);\r\n}\r\n<\/code><\/pre>\r\n<pre><code class=\"language-php\">\/\/ functions.php\uff08After\uff09\r\nfunction page_is_ancestor_of($slug) {\r\n    \/\/ \u914d\u5217\u304c\u6e21\u3055\u308c\u305f\u5834\u5408\u3001\u5404\u8981\u7d20\u306b\u5bfe\u3057\u3066\u518d\u5e30\u7684\u306b\u30c1\u30a7\u30c3\u30af\r\n    if (is_array($slug)) {\r\n        foreach ($slug as $s) {\r\n            if (page_is_ancestor_of($s)) {\r\n                return true;\r\n            }\r\n        }\r\n        return false;\r\n    }\r\n\r\n    \/\/ \u6587\u5b57\u5217\u306e\u5834\u5408\u306f\u5f93\u6765\u306e\u51e6\u7406\r\n    $queried = get_queried_object();\r\n    $page = get_page_by_path($slug);\r\n    if (!$page) return false;\r\n    return ($queried instanceof WP_Post &amp;&amp; $queried-&gt;post_parent == $page-&gt;ID);\r\n}\r\n<\/code><\/pre>\r\n<h3 class=\"fz-ml\">\u30dd\u30a4\u30f3\u30c8<\/h3>\r\n<ul style=\"list-style-type:bullet;\" class=\"my-0.5r\">\r\n  <li>\u95a2\u6570\u306e\u5148\u982d\u3067 <code>is_array()<\/code> \u30c1\u30a7\u30c3\u30af\u3092\u8ffd\u52a0\u3059\u308b<\/li>\r\n  <li>\u914d\u5217\u306e\u5834\u5408\u306f\u5404\u8981\u7d20\u306b\u5bfe\u3057\u3066\u81ea\u5206\u81ea\u8eab\u3092\u518d\u5e30\u547c\u3073\u51fa\u3057\u3059\u308b<\/li>\r\n  <li>\u3053\u3046\u3059\u308b\u3053\u3068\u3067\u3001\u6587\u5b57\u5217\u3067\u306e\u547c\u3073\u51fa\u3057\u3068\u3082\u5f8c\u65b9\u4e92\u63db\u6027\u3092\u4fdd\u3066\u308b<\/li>\r\n<\/ul>\r\n<p>\u3053\u306e\u4fee\u6b63\u65b9\u6cd5\u306e\u30e1\u30ea\u30c3\u30c8\u306f\u3001\u547c\u3073\u51fa\u3057\u5074\u306e\u30b3\u30fc\u30c9\u3092\u4e00\u5207\u5909\u66f4\u305b\u305a\u306b\u6e08\u3080\u70b9\u3067\u3059\u3002\u5171\u901a\u30d5\u30a1\u30a4\u30eb\u3092\u5909\u66f4\u3059\u308b\u3068\u3001\u8907\u6570\u30c6\u30fc\u30de\u30fb\u8907\u6570\u30da\u30fc\u30b8\u306b\u5f71\u97ff\u304c\u5e83\u304c\u308b\u30ea\u30b9\u30af\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\r\n\r\n<hr class=\"separator mt-3r\">\r\n\r\n<h2 class=\"fz-xl\">\u30a8\u30e9\u30fc\u306e\u9023\u9396\u69cb\u9020\uff1ainclude\u306e\u5931\u6557\u304csession_start\u3092\u6b62\u3081\u308b<\/h2>\r\n<p>PHP8\u79fb\u884c\u3067\u767a\u751f\u3059\u308b\u30a8\u30e9\u30fc\u306e\u4e2d\u306b\u306f\u3001<b class=\"bold\">1\u3064\u306e\u6839\u672c\u539f\u56e0\u304c\u8907\u6570\u306e\u30a8\u30e9\u30fc\u3092\u5f15\u304d\u8d77\u3053\u3059\u9023\u9396\u69cb\u9020<\/b> \u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u3092\u7406\u89e3\u3057\u3066\u3044\u306a\u3044\u3068\u3001\u898b\u3048\u3066\u3044\u308b\u30a8\u30e9\u30fc\u3092\u3059\u3079\u3066\u500b\u5225\u306b\u4fee\u6b63\u3057\u3088\u3046\u3068\u3057\u3066\u7121\u99c4\u306a\u4f5c\u696d\u304c\u5897\u3048\u307e\u3059\u3002<\/p>\r\n\r\n<p class=\"mt-1r\"><b class=\"bold\">\u5b9f\u969b\u306b\u8d77\u304d\u305f\u9023\u9396\u306e\u4f8b<\/b>\r\n<p>error.log\u306b\u6b21\u306e\u3088\u3046\u306a\u30a8\u30e9\u30fc\u304c\u8907\u6570\u51fa\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\r\n<pre><code class=\"language-\">PHP Warning: include(css\/_layouts\/ly-header.css.php): Failed to open stream: No such file or directory in functions.php on line 16\r\nPHP Warning: session_start(): Session cannot be started after headers have been sent in functions.php on line 57\r\n<\/code><\/pre>\r\n<p>2\u7a2e\u985e\u306eWarning\u304c\u51fa\u3066\u3044\u307e\u3059\u304c\u3001<b class=\"bold\">\u6839\u672c\u539f\u56e0\u306f1\u3064<\/b> \u3067\u3059\u3002<\/p>\r\n\r\n<p class=\"mt-1r\"><b class=\"bold\">\u9023\u9396\u306e\u4ed5\u7d44\u307f<\/b>\r\n<pre><code class=\"language-\">&lsqb;1&rsqb; functions.php: include\u3057\u3088\u3046\u3068\u3057\u305fCSS\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3057\u306a\u3044\r\n        \u2193\r\n&lsqb;2&rsqb; PHP\u304c\u300c\u30d5\u30a1\u30a4\u30eb\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u300d\u3068\u3044\u3046\u8b66\u544a\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u51fa\u529b\u3059\u308b\r\n        \u2193\r\n&lsqb;3&rsqb; \u305d\u306e\u8b66\u544a\u30c6\u30ad\u30b9\u30c8\u304cHTML\u3088\u308a\u5148\u306b\u51fa\u529b\u3055\u308c\u3066\u3057\u307e\u3046\uff08\u30d8\u30c3\u30c0\u30fc\u9001\u4fe1\u6e08\u307f\u72b6\u614b\u306b\uff09\r\n        \u2193\r\n&lsqb;4&rsqb; session_start() \u306f\u300c\u30d8\u30c3\u30c0\u30fc\u9001\u4fe1\u524d\u300d\u306b\u547c\u3070\u308c\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u305f\u3081\u3001\r\n    \u300c\u3082\u3046\u30d8\u30c3\u30c0\u30fc\u304c\u9001\u3089\u308c\u3066\u308b\u304b\u3089\u958b\u59cb\u3067\u304d\u306a\u3044\u300d\u3068\u3044\u3046Warning\u304c\u51fa\u308b\r\n<\/code><\/pre>\r\n<p><b class=\"bold\">\u76f4\u3059\u3079\u304d\u306fCSS\u30d5\u30a1\u30a4\u30eb\u540d\u306e\u53c2\u7167\u30df\u30b9\uff08&lsqb;1&rsqb;\uff09\u3060\u3051<\/b> \u3067\u3059\u3002&lsqb;4&rsqb;\u306esession_start\u306eWarning\u306f\u3001&lsqb;1&rsqb;\u3092\u76f4\u305b\u3070\u81ea\u52d5\u7684\u306b\u6d88\u3048\u307e\u3059\u3002<\/p>\r\n\r\n<h3 class=\"fz-ml\">\u539f\u56e0\uff1a\u30c6\u30fc\u30de\u8907\u88fd\u6642\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u66f4\u65b0\u6f0f\u308c<\/h3>\r\n<p>\u4eca\u56de\u306e\u5834\u5408\u3001\u30c6\u30fc\u30de\u3092\u8907\u88fd\u3057\u3066\u65b0\u30c6\u30fc\u30de\u3092\u4f5c\u3063\u305f\u969b\u306b\u3001CSS\u30d5\u30a1\u30a4\u30eb\u540d\u304c\u5909\u308f\u3063\u3066\u3044\u308b\u306e\u306b\u30b3\u30fc\u30c9\u5185\u306e\u53c2\u7167\u304c\u53e4\u3044\u307e\u307e\u3060\u3063\u305f\u306e\u304c\u539f\u56e0\u3067\u3057\u305f\u3002<\/p>\r\n<pre><code class=\"language-php\">\/\/ functions.php\uff08Before\uff09\uff1a\u53e4\u3044\u30c6\u30fc\u30de\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u304c\u6b8b\u3063\u3066\u3044\u308b\r\ninclude get_template_directory() . &#39;\/css\/_layouts\/ly-header.css.php&#39;;\r\n<\/code><\/pre>\r\n<pre><code class=\"language-php\">\/\/ functions.php\uff08After\uff09\uff1a\u6b63\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u540d\u306b\u4fee\u6b63 + \u5b58\u5728\u30c1\u30a7\u30c3\u30af\u3082\u8ffd\u52a0\r\n$css_file = get_template_directory() . &#39;\/css\/_layouts\/ly-header-form.css.php&#39;;\r\nif (file_exists($css_file)) {\r\n    include $css_file;\r\n}\r\n<\/code><\/pre>\r\n<p><code>file_exists()<\/code> \u30c1\u30a7\u30c3\u30af\u3092\u8ffd\u52a0\u3057\u3066\u304a\u304f\u3068\u3001\u5c06\u6765\u307e\u305f\u30d5\u30a1\u30a4\u30eb\u540d\u304c\u5909\u308f\u3063\u3066\u3082\u8b66\u544a\u304c\u51fa\u306a\u304f\u306a\u308a\u307e\u3059\uff08include\u306e\u307f\u304c\u7121\u8996\u3055\u308c\u307e\u3059\uff09\u3002<\/p>\r\n<h3 class=\"fz-ml\">session_start() \u306e\u8ffd\u52a0\u5bfe\u7b56<\/h3>\r\n<p>\u6839\u672c\u539f\u56e0\uff08\u30d5\u30a1\u30a4\u30eb\u540d\uff09\u3092\u4fee\u6b63\u3059\u308b\u306e\u304c\u6700\u512a\u5148\u3067\u3059\u304c\u3001\u5ff5\u306e\u305f\u3081 <code>session_start()<\/code> \u306b\u3082\u9632\u5fa1\u7684\u306a\u30c1\u30a7\u30c3\u30af\u3092\u52a0\u3048\u3066\u304a\u304f\u3068\u5b89\u5fc3\u3067\u3059\u3002<\/p>\r\n<pre><code class=\"language-php\">\/\/ Before\r\nadd_action(&#39;init&#39;, &#39;my_session_start&#39;);\r\nfunction my_session_start() {\r\n    session_start();\r\n}\r\n<\/code><\/pre>\r\n<pre><code class=\"language-php\">\/\/ After\r\nadd_action(&#39;init&#39;, &#39;my_session_start&#39;, 1);  \/\/ priority \u30921\u306b\u3057\u3066\u65e9\u3081\u306b\u5b9f\u884c\r\nfunction my_session_start() {\r\n    if (!headers_sent() &amp;&amp; session_status() === PHP_SESSION_NONE) {\r\n        session_start();\r\n    }\r\n}\r\n<\/code><\/pre>\r\n<ul style=\"list-style-type:bullet;\" class=\"my-0.5r\">\r\n  <li><code>headers_sent()<\/code> \u3067\u30d8\u30c3\u30c0\u30fc\u304c\u307e\u3060\u9001\u4fe1\u3055\u308c\u3066\u3044\u306a\u3044\u304b\u78ba\u8a8d<\/li>\r\n  <li><code>session_status()<\/code> \u3067\u30bb\u30c3\u30b7\u30e7\u30f3\u304c\u672a\u958b\u59cb\u304b\u3069\u3046\u304b\u78ba\u8a8d<\/li>\r\n  <li><code>priority<\/code> \u3092 <code>1<\/code> \u306b\u3059\u308b\u3053\u3068\u3067\u4ed6\u306e\u30d5\u30c3\u30af\u3088\u308a\u5148\u306b\u5b9f\u884c<\/li>\r\n<\/ul>\r\n\r\n<hr class=\"separator mt-3r\">\r\n\r\n<h2 class=\"fz-xl\">\u30c6\u30fc\u30de\u8907\u88fd\u6642\u306e4\u5927\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8<\/h2>\r\n<p>\u65e2\u5b58\u30c6\u30fc\u30de\u3092\u30b3\u30d4\u30fc\u3057\u3066\u65b0\u3057\u3044\u30c6\u30fc\u30de\u3092\u4f5c\u3063\u305f\u5834\u5408\u3001\u6b21\u306e4\u70b9\u304c\u66f4\u65b0\u6f0f\u308c\u306b\u306a\u308a\u3084\u3059\u3044\u3067\u3059\u3002<\/p>\r\n<h3 class=\"fz-ml\">\u30c1\u30a7\u30c3\u30af1\uff1a\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u306e\u5b9a\u7fa9<\/h3>\r\n<pre><code class=\"language-php\">\/\/ functions.php \u3067\u3053\u306e\u3088\u3046\u306a\u5909\u6570\u304c\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\r\n$global_session_params = array(\r\n    &#39;site_id&#39; =&gt; &#39;my-site&#39;,\r\n    \/\/ ...\r\n);\r\n<\/code><\/pre>\r\n<p>\u8907\u88fd\u5143\u30c6\u30fc\u30de\u306e <code>functions.php<\/code> \u306b\u3042\u3063\u305f\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u5b9a\u7fa9\u304c\u3001\u65b0\u30c6\u30fc\u30de\u306b\u5f15\u304d\u7d99\u304c\u308c\u3066\u3044\u308b\u304b\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\r\n<p><code>head.php<\/code> \u306a\u3069\u306e\u5171\u901a\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u304c <code>global $xxxx<\/code> \u3067\u53c2\u7167\u3057\u3066\u3044\u308b\u5909\u6570\u306f\u3001<code>functions.php<\/code> \u306b\u5b9a\u7fa9\u304c\u306a\u3044\u3068Warning\u306e\u539f\u56e0\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\r\n<h3 class=\"fz-ml\">\u30c1\u30a7\u30c3\u30af2\uff1aCSS\u30d5\u30a1\u30a4\u30eb\u540d\u306e\u53c2\u7167<\/h3>\r\n<p>\u30c6\u30fc\u30de\u306eCSS\u30d5\u30a1\u30a4\u30eb\uff08<code>css\/_layouts\/<\/code> \u5185\u306a\u3069\uff09\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u5909\u3048\u305f\u5834\u5408\u3001\u30b3\u30fc\u30c9\u5185\u306e\u53c2\u7167\u7b87\u6240\u3092\u3059\u3079\u3066\u66f4\u65b0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\r\n<p>\u691c\u7d22\u3059\u3079\u304d\u7b87\u6240\uff1a<\/p>\r\n<ul style=\"list-style-type:bullet;\" class=\"my-0.5r\">\r\n  <li><code>functions.php<\/code> \u306e <code>wp_enqueue_style()<\/code> \u3084 <code>include<\/code><\/li>\r\n  <li><code>head.php<\/code><\/li>\r\n  <li><code>footer-*.php<\/code><\/li>\r\n  <li><code>below-fold.php<\/code> \u306a\u3069JS\u30ed\u30fc\u30c0\u30fc\u30d5\u30a1\u30a4\u30eb<\/li>\r\n<\/ul>\r\n<h3 class=\"fz-ml\">\u30c1\u30a7\u30c3\u30af3\uff1a\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\u53c2\u7167<\/h3>\r\n<pre><code class=\"language-php\">\/\/ functions.php\r\nadd_feed(&#39;feed-rss2&#39;, function() {\r\n    load_template(get_template_directory() . &#39;\/commons\/feed-rss2.php&#39;);  \/\/ \u6b63\u3057\u3044\u30d1\u30b9\r\n    \/\/ load_template(get_template_directory() . &#39;\/parts\/feed-rss2.php&#39;);  \/\/ \u53e4\u3044\u30d1\u30b9\r\n});\r\n<\/code><\/pre>\r\n<p><code>parts\/<\/code> \u3084 <code>commons\/<\/code> \u306a\u3069\u3001\u30c6\u30fc\u30de\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u9020\u304c\u8907\u88fd\u5143\u3068\u7570\u306a\u308b\u5834\u5408\u3001\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\u306e\u53c2\u7167\u3082\u66f4\u65b0\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\r\n<h3 class=\"fz-ml\">\u30c1\u30a7\u30c3\u30af4\uff1a\u95a2\u6570\u306e\u5f15\u6570\u578b<\/h3>\r\n<p><code>page_is_ancestor_of()<\/code> \u306e\u4f8b\u306e\u3088\u3046\u306b\u3001\u5171\u901a\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u304b\u3089\u95a2\u6570\u3092\u547c\u3076\u5074\u304c\u914d\u5217\u306a\u3069\u3092\u6e21\u3057\u3066\u3044\u308b\u5834\u5408\u3001<b class=\"bold\">\u95a2\u6570\u304c\u914d\u5217\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u304b<\/b>\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\r\n<p>PHP7.x\u3067\u306f\u52d5\u3044\u3066\u3044\u3066\u3082\u3001PHP8.x\u3067\u578b\u304c\u53b3\u683c\u306b\u306a\u3063\u3066Fatal Error\u306b\u306a\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\r\n\r\n<hr class=\"separator mt-3r\">\r\n\r\n<h2 class=\"fz-xl\">\u30a8\u30e9\u30fc\u5bfe\u51e6\u306e\u9806\u756a\u307e\u3068\u3081<\/h2>\r\n<ol style=\"list-style-type:decimal;\" class=\"my-0.5r\">\r\n  <li><b class=\"bold\">Fatal error<\/b> \u3092\u6700\u512a\u5148\u3067\u4fee\u6b63\uff08\u30b5\u30a4\u30c8\u304c\u6b62\u307e\u308b\uff09<\/li>\r\n  <li><b class=\"bold\">Warning<\/b> \u3092\u7a2e\u985e\u3054\u3068\u306b\u4fee\u6b63<\/li>\r\n  <li>\u9023\u9396\u3057\u3066\u3044\u308bWarning\u306f\u6839\u672c\u539f\u56e0\u304b\u3089\u76f4\u3059\uff08downstream \u306e\u30a8\u30e9\u30fc\u306f\u81ea\u52d5\u7684\u306b\u6d88\u3048\u308b\uff09<\/li>\r\n<\/ol>\r\n\r\n<table class=\"table my-0.5r\">\r\n  <thead>\r\n    <tr class=\"rung\">\r\n      <th>\u30a8\u30e9\u30fc<\/th>\r\n      <td>\u539f\u56e0<\/td>\r\n      <td>\u5bfe\u51e6<\/td>\r\n    <\/tr>\r\n  <\/thead>\r\n  <tbody>\r\n    <tr class=\"rung\">\r\n      <th><code>get_page_by_path()<\/code> Fatal Error<\/th>\r\n      <td>PHP8\u306e\u578b\u53b3\u683c\u5316\u3067\u914d\u5217\u3092\u6e21\u3059\u3068Fatal<\/td>\r\n      <td>\u95a2\u6570\u5074\u306b<code>is_array()<\/code> + \u518d\u5e30\u5bfe\u5fdc\u3092\u8ffd\u52a0<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><code>session_start()<\/code> Warning<\/th>\r\n      <td>include\u5931\u6557\u306e\u51fa\u529b\u304c\u30d8\u30c3\u30c0\u30fc\u9001\u4fe1\u3092\u5f15\u304d\u8d77\u3053\u3059\u9023\u9396<\/td>\r\n      <td>\u6839\u672c\u539f\u56e0\uff08\u30d5\u30a1\u30a4\u30eb\u540d\uff09\u3092\u76f4\u3059<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th>\u30c6\u30fc\u30de\u8907\u88fd\u5f8c\u306e\u5404\u7a2e\u30a8\u30e9\u30fc<\/th>\r\n      <td>\u30d5\u30a1\u30a4\u30eb\u540d\u30fb\u30d1\u30b9\u30fb\u5909\u6570\u5b9a\u7fa9\u306e\u66f4\u65b0\u6f0f\u308c<\/td>\r\n      <td>4\u5927\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8\u3067\u78ba\u8a8d<\/td>\r\n    <\/tr>\r\n  <\/tbody>\r\n<\/table>\r\n<p>PHP7.x\u304b\u30898.x\u3078\u306e\u79fb\u884c\u306f\u3001\u300c\u4eca\u307e\u3067\u898b\u9003\u3055\u308c\u3066\u304d\u305f\u554f\u984c\u304c\u8868\u9762\u5316\u3059\u308b\u300d\u30d7\u30ed\u30bb\u30b9\u3067\u3059\u3002<br \/>\r\n  \u30a8\u30e9\u30fc\u30ed\u30b0\u3092\u6839\u6c17\u3088\u304f\u8aad\u3093\u3067\u30011\u7a2e\u985e\u305a\u3064\u4fee\u6b63\u3057\u3066\u3044\u3051\u3070\u5fc5\u305a\u89e3\u6d88\u3067\u304d\u307e\u3059\u3002<\/p>\r\n\r\n<hr class=\"separator mx-auto mt-3r\" \/>\r\n\r\n<h2 class=\"fz-xl\"><span>\u95a2\u9023\u8a18\u4e8b<\/span><\/h2>\r\n\r\n<a href=\"https:\/\/code-plus.jp\/gp\/php8-warning-11409\/\" class=\"linkbox my-1.5r\">\r\n<h4 class=\"linkbox-title fz-md\">PHP8\u79fb\u884c\u3067WordPress\u30c6\u30fc\u30de\u306b\u51fa\u308bWarning 5\u30d1\u30bf\u30fc\u30f3\u3068\u4fee\u6b63\u30b3\u30fc\u30c9\u3010\u5b9f\u4f8b\u4ed8\u304d\u3011<\/h4>\r\n<picture class=\"linkbox-thumbnail\">\r\n<img decoding=\"async\" width=\"300\" height=\"200\" src=\"https:\/\/code-plus.jp\/gp\/wp-content\/uploads\/7d1dec178674388d0e81629e134794f6.jpg?ver=20260317183533\" alt=\"PHP8\u79fb\u884c\u3067WordPress\u30c6\u30fc\u30de\u306b\u51fa\u308bWarning 5\u30d1\u30bf\u30fc\u30f3\u3068\u4fee\u6b63\u30b3\u30fc\u30c9\u3010\u5b9f\u4f8b\u4ed8\u304d\u3011\" loading=\"lazy\" \/>\r\n<\/picture>\r\n<span class=\"linkbox-excerpt\">PHP7\u2192PHP8\u3078\u306e\u79fb\u884c\u5f8c\u306bWordPress\u30c6\u30fc\u30de\u3067\u5b9f\u969b\u306b\u767a\u751f\u3057\u305fPHP Warning 5\u7a2e\u985e\u3092\u3001before\/after\u306e\u30b3\u30fc\u30c9\u4ed8\u304d\u3067\u89e3\u8aac\u3002$post\u306enull\u30c1\u30a7\u30c3\u30af\u30fbget_post_meta()\u306efalse\u5bfe\u5fdc\u30fbforeach\u306enull\u5f15\u6570\u30fb$_...\r\n&emsp;<u class=\"linkbox-more\">\u7d9a\u304d\u3092\u8aad\u3080<\/u>\r\n<\/span>\r\n<\/a>\r\n\r\n<a href=\"https:\/\/code-plus.jp\/gp\/php-errorlog-11405\/\" class=\"linkbox my-1.5r\">\r\n<h4 class=\"linkbox-title fz-md\">PHP7\u2192PHP8\u306b\u4e0a\u3052\u305f\u3089error.log\u304c\u5897\u3048\u305f\u3002\u307e\u305a\u4f55\u3092\u3059\u3079\u304d\u304b\u3010WordPress\u3011<\/h4>\r\n<picture class=\"linkbox-thumbnail\">\r\n<img decoding=\"async\" width=\"300\" height=\"200\" src=\"https:\/\/code-plus.jp\/gp\/wp-content\/uploads\/4cf7b253552c74979e3a7b9c6717ef47.jpg?ver=20260317183533\" alt=\"PHP7\u2192PHP8\u306b\u4e0a\u3052\u305f\u3089error.log\u304c\u5897\u3048\u305f\u3002\u307e\u305a\u4f55\u3092\u3059\u3079\u304d\u304b\u3010WordPress\u3011\" loading=\"lazy\" \/>\r\n<\/picture>\r\n<span class=\"linkbox-excerpt\">PHP7.4\u304b\u3089PHP8\u3078\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u5f8c\u306berror.log\u304c\u6025\u5897\u3059\u308b\u539f\u56e0\u3068\u3001\u6700\u521d\u306b\u3084\u308b\u3079\u304d\u5bfe\u51e6\u306e\u6d41\u308c\u3092\u89e3\u8aac\u3002sort -u\u3067\u30ed\u30b0\u3092\u30e6\u30cb\u30fc\u30af\u5316\u3059\u308b\u65b9\u6cd5\u3001Fatal\u3068Warning\u306e\u512a\u5148\u9806\u4f4d\u306e\u5224\u65ad\u306a\u3069\u3001WordPress\u30c6\u30fc\u30de\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3057\u3066\u3044\u308b\u30ec\u30d9\u30eb\u306e...\r\n&emsp;<u class=\"linkbox-more\">\u7d9a\u304d\u3092\u8aad\u3080<\/u>\r\n<\/span>\r\n<\/a>\r\n\r\n<a href=\"https:\/\/code-plus.jp\/gp\/error-null-9560\/\" class=\"linkbox my-1.5r\">\r\n<h4 class=\"linkbox-title fz-md\">WordPress $post\u5909\u6570\u306enull\u30a8\u30e9\u30fc\u3092\u5b8c\u5168\u89e3\u6c7a\uff01error_log\u3092\u7dba\u9e97\u306b\u3059\u308b\u5b9f\u8df5\u7684\u4fee\u6b63\u30ac\u30a4\u30c9<\/h4>\r\n<picture class=\"linkbox-thumbnail\">\r\n<img decoding=\"async\" width=\"300\" height=\"200\" src=\"https:\/\/code-plus.jp\/gp\/wp-content\/uploads\/709908c76c94361c5aecc71412bcd1c1.jpg?ver=20260317183533\" alt=\"WordPress $post\u5909\u6570\u306enull\u30a8\u30e9\u30fc\u3092\u5b8c\u5168\u89e3\u6c7a\uff01error_log\u3092\u7dba\u9e97\u306b\u3059\u308b\u5b9f\u8df5\u7684\u4fee\u6b63\u30ac\u30a4\u30c9\" loading=\"lazy\" \/>\r\n<\/picture>\r\n<span class=\"linkbox-excerpt\">WordPress\u306eerror_log\u306b\u983b\u51fa\u3059\u308b\u300cAttempt to read property on null\u300d\u300cUndefined array key\u300d\u30a8\u30e9\u30fc\u3002$post\u5909\u6570\u3084$_GET\u914d\u5217\u304c\u539f\u56e0\u3067\u3059\u3002\u672c\u8a18\u4e8b\u3067\u306f\u5178\u578b\u7684\u306a\u30d1\u30bf\u30fc\u30f3\u3068\u4fee\u6b63\u65b9\u6cd5\u3001\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570...\r\n&emsp;<u class=\"linkbox-more\">\u7d9a\u304d\u3092\u8aad\u3080<\/u>\r\n<\/span>\r\n<\/a>","protected":false},"excerpt":{"rendered":"PHP8\u79fb\u884c\u5f8c\u306bWordPress\u304c\u771f\u3063\u767d\u306b\u306a\u308bFatal Error\u306e\u539f\u56e0\u3068\u4fee\u6b63\u65b9\u6cd5\u3092\u5b9f\u4f8b\u3067\u89e3\u8aac\u3002get_page_by_path()\u3078\u306e\u914d\u5217\u6e21\u3057\u554f\u984c\u3001include\u306e\u5931\u6557\u304csession_start\u30a8\u30e9\u30fc\u3092\u5f15\u304d\u8d77\u3053\u3059\u9023\u9396\u69cb\u9020\u306e\u3057\u304f\u307f\u3001\u30c6\u30fc\u30de\u8907\u88fd\u6642\u306b\u8d77\u304d\u3084\u3059\u3044\u30d5\u30a1\u30a4\u30eb\u540d\u30fb\u30d1\u30b9\u30fb\u5909\u6570\u5b9a\u7fa9\u306e\u66f4\u65b0\u6f0f\u308c\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8\u3082\u307e\u3068\u3081\u3066\u3044\u307e\u3059\u3002","protected":false},"author":1,"featured_media":11416,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[782,783,784,776,777,772,778,155,102,111],"class_list":{"0":"post-11413","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-wordpress","8":"tag-session_start","9":"tag-get_page_by_path","10":"tag-784","11":"tag-php","12":"tag-fatal-error","13":"tag-php8","14":"tag-wordpress","15":"tag-functions-php"},"_links":{"self":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/11413","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=11413"}],"version-history":[{"count":7,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/11413\/revisions"}],"predecessor-version":[{"id":11431,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/11413\/revisions\/11431"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media\/11416"}],"wp:attachment":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media?parent=11413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/categories?post=11413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/tags?post=11413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}