{"id":11409,"date":"2026-03-17T18:01:01","date_gmt":"2026-03-17T09:01:01","guid":{"rendered":"https:\/\/code-plus.jp\/gp\/?p=11409"},"modified":"2026-03-17T18:28:39","modified_gmt":"2026-03-17T09:28:39","slug":"php8-warning-11409","status":"publish","type":"post","link":"https:\/\/code-plus.jp\/gp\/php8-warning-11409\/","title":{"rendered":"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"},"content":{"rendered":"<!--\r\ntitle: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\r\ndescription: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$_GET\u306e\u5b58\u5728\u78ba\u8a8d\u30fbif-else\u306e\u5909\u6570\u5b9a\u7fa9\u6f0f\u308c\u3002functions.php\u3092\u66f8\u304f\u30ec\u30d9\u30eb\u306e\u65b9\u5411\u3051\u306b\u308f\u304b\u308a\u3084\u3059\u304f\u8aac\u660e\u3057\u3066\u3044\u307e\u3059\u3002\r\ntags:PHP, PHP8, WordPress, PHP\u30a8\u30e9\u30fc, Warning, functions.php, isset, get_post_meta, $post, WordPress\u79fb\u884c\r\n-->\r\n\r\n<p>\u524d\u306e\u8a18\u4e8b\u3067\u306f\u300cPHP8\u3067\u4f55\u304c\u5909\u308f\u3063\u305f\u304b\u300d\u3068\u300cerror.log\u306e\u8aad\u307f\u65b9\u300d\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<br \/>\r\n  \u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001\u5b9f\u969b\u306b\u767a\u751f\u3057\u305fWarning 5\u30d1\u30bf\u30fc\u30f3\u3092\u3001before\/after\u306e\u30b3\u30fc\u30c9\u3064\u304d\u3067\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\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=20260317182839\" 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<!-- \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\">\u30d1\u30bf\u30fc\u30f31\uff1a<code>$post-&gt;post_name<\/code> on null<\/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 Warning: Attempt to read property &quot;post_name&quot; on null in header.php on line 229\r\n<\/code><\/pre>\r\n<p class=\"mt-1r\"><b class=\"bold\">\u539f\u56e0<\/b><\/p>\r\n<p>\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570 <code>$post<\/code> \u306f\u3001\u6295\u7a3f\u30fb\u56fa\u5b9a\u30da\u30fc\u30b8\u3092\u8868\u793a\u3057\u3066\u3044\u308b\u3068\u304d\u306fWordPress\u304c\u81ea\u52d5\u7684\u306b\u30bb\u30c3\u30c8\u3057\u3066\u304f\u308c\u307e\u3059\u3002\u3068\u3053\u308d\u304c\u3001<b class=\"bold\">\u30a2\u30fc\u30ab\u30a4\u30d6\u30da\u30fc\u30b8\u30fb\u691c\u7d22\u7d50\u679c\u30da\u30fc\u30b8\u30fb404\u30da\u30fc\u30b8<\/b>\u3067\u306f <code>$post<\/code> \u304c <code>null<\/code> \u306b\u306a\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\r\n<p>PHP7.x\u3067\u306f <code>null<\/code> \u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3078\u306e\u30a2\u30af\u30bb\u30b9\u304cNotice\u3067\u6e08\u3093\u3067\u3044\u307e\u3057\u305f\u304c\u3001PHP8.x\u3067\u306fWarning\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\r\n<h3 class=\"fz-ml\">Before\uff08\u3088\u304f\u66f8\u304b\u308c\u3066\u3044\u308b\u30b3\u30fc\u30c9\uff09<\/h3>\r\n<p><code>header.php<\/code> \u3084 <code>index.php<\/code> \u306e\u3088\u3046\u306b\u3001body\u30bf\u30b0\u306eid\u5c5e\u6027\u3084\u30b9\u30e9\u30c3\u30b0\u53d6\u5f97\u3067\u4f7f\u308f\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u591a\u3044\u3067\u3059\u3002<\/p>\r\n<pre><code class=\"language-php\">\/\/ header.php\r\n&lt;body id=&#39;&lt;?php echo esc_attr($post-&gt;post_name); ?&gt;&#39;&gt;\r\n<\/code><\/pre>\r\n<pre><code class=\"language-php\">\/\/ index.php\r\n$slug = $post-&gt;post_name;\r\n<\/code><\/pre>\r\n<h3 class=\"fz-ml\">After\uff08\u4fee\u6b63\u5f8c\uff09<\/h3>\r\n<p><code>isset()<\/code> \u3067 <code>$post-&gt;post_name<\/code> \u304c\u5b58\u5728\u3059\u308b\u304b\u78ba\u8a8d\u3057\u3066\u304b\u3089\u4f7f\u3044\u307e\u3059\u3002<\/p>\r\n<pre><code class=\"language-php\">\/\/ header.php\r\n&lt;body id=&#39;&lt;?php echo esc_attr(isset($post-&gt;post_name) ? $post-&gt;post_name : &#39;&#39;); ?&gt;&#39;&gt;\r\n<\/code><\/pre>\r\n<pre><code class=\"language-php\">\/\/ index.php\r\n$slug = isset($post-&gt;post_name) ? $post-&gt;post_name : &#39;&#39;;\r\n<\/code><\/pre>\r\n<h3 class=\"fz-ml ignore-toc-scope\">\u30dd\u30a4\u30f3\u30c8<\/h3>\r\n<p><code>$post<\/code> \u81ea\u4f53\u304c <code>null<\/code> \u306e\u3068\u304d\u3001<code>$post-&gt;post_name<\/code> \u306b\u30a2\u30af\u30bb\u30b9\u3057\u3088\u3046\u3068\u3059\u308b\u3068Warning\u304c\u51fa\u307e\u3059\u3002<code>isset($post)<\/code> \u3060\u3051\u3067\u306a\u304f <code>isset($post-&gt;post_name)<\/code> \u3068\u66f8\u304f\u3053\u3068\u3067\u3001<code>$post<\/code> \u304c null \u306e\u5834\u5408\u3082\u542b\u3081\u3066\u5b89\u5168\u306b\u30c1\u30a7\u30c3\u30af\u3067\u304d\u307e\u3059\u3002<\/p>\r\n\r\n<hr class=\"separator mt-3r\">\r\n\r\n<h2 class=\"fz-xl\">\u30d1\u30bf\u30fc\u30f32\uff1a<code>get_post_meta()<\/code> \u306e\u623b\u308a\u5024\u306b <code>++<\/code> \u3092\u3057\u305f\u3068\u304d\u306eWarning<\/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 Deprecated: Increment on type bool in functions.php on line 1034\r\n<\/code><\/pre>\r\n<p class=\"mt-1r\"><b class=\"bold\">\u539f\u56e0<\/b><\/p>\r\n<p>\u30d3\u30e5\u30fc\u30ab\u30a6\u30f3\u30c8\uff08\u95b2\u89a7\u6570\uff09\u306e\u5b9f\u88c5\u3067\u3088\u304f\u4f7f\u308f\u308c\u308b\u30d1\u30bf\u30fc\u30f3\u3067\u3059\u3002<code>get_post_meta()<\/code> \u306f<b class=\"bold\">\u5024\u304c\u5b58\u5728\u3057\u306a\u3044\u5834\u5408\u306b <code>false<\/code> \u3092\u8fd4\u3057\u307e\u3059<\/b>\u3002<\/p>\r\n<p>PHP7.x\u3067\u306fbool\u578b\u306b <code>++<\/code> \u3057\u3066\u3082\u52d5\u4f5c\u3057\u3066\u3044\u307e\u3057\u305f\u304c\u3001PHP8.3\u4ee5\u964d\u3067\u306f <code>Deprecated<\/code>\uff08\u975e\u63a8\u5968\uff09\u306e\u8b66\u544a\u304c\u51fa\u307e\u3059\u3002<\/p>\r\n<h3 class=\"fz-ml\">Before\uff08\u3088\u304f\u66f8\u304b\u308c\u3066\u3044\u308b\u30b3\u30fc\u30c9\uff09<\/h3>\r\n<pre><code class=\"language-php\">$post_views_count = get_post_meta($post_id, $custom_key, true);\r\n\r\nif ($post_views_count === &#39;&#39;) {\r\n    delete_post_meta($post_id, $custom_key);\r\n    add_post_meta($post_id, $custom_key, &#39;0&#39;);\r\n} else {\r\n    $post_views_count++;  \/\/ false\u304c\u6765\u305f\u3068\u304d\u306b bool \u3078\u306e++ \u306b\u306a\u308b\r\n    update_post_meta($post_id, $custom_key, $post_views_count);\r\n}\r\n<\/code><\/pre>\r\n\r\n<h3 class=\"fz-ml ignore-toc-scope\">\u554f\u984c\u70b9<\/h3>\r\n<p><code>get_post_meta()<\/code> \u306e\u623b\u308a\u5024\u306f <code>string | false<\/code> \u3067\u3059\u3002\u7b2c3\u5f15\u6570\u3092 <code>true<\/code> \u306b\u3057\u305f\u5834\u5408\u3001\u30e1\u30bf\u30c7\u30fc\u30bf\u304c\u5b58\u5728\u3057\u306a\u3044\u3068 <code>false<\/code> \u304c\u8fd4\u308a\u307e\u3059\u3002<code>=== &#39;&#39;<\/code> \u306e\u30c1\u30a7\u30c3\u30af\u3060\u3051\u3067\u306f <code>false<\/code> \u3092\u6355\u6349\u3067\u304d\u306a\u3044\u305f\u3081\u3001<code>else<\/code> \u30d6\u30ed\u30c3\u30af\u306b <code>false<\/code> \u304c\u6d41\u308c\u8fbc\u3093\u3067 <code>false++<\/code> \u306b\u306a\u308a\u307e\u3059\u3002<\/p>\r\n<h3 class=\"fz-ml\">After\uff08\u4fee\u6b63\u5f8c\uff09<\/h3>\r\n<pre><code class=\"language-php\">$post_views_count = get_post_meta($post_id, $custom_key, true);\r\n\r\nif ($post_views_count === &#39;&#39; || $post_views_count === false) {\r\n    \/\/ \u30e1\u30bf\u30c7\u30fc\u30bf\u304c\u5b58\u5728\u3057\u306a\u3044 or \u7a7a\u306e\u3068\u304d \u2192 \u521d\u56de\u95b2\u89a7\u306a\u306e\u30671\u3092\u30bb\u30c3\u30c8\r\n    delete_post_meta($post_id, $custom_key);\r\n    add_post_meta($post_id, $custom_key, &#39;1&#39;);\r\n} else {\r\n    \/\/ \u660e\u793a\u7684\u306b (int) \u30ad\u30e3\u30b9\u30c8\u3057\u3066\u304b\u3089 +1 \u3059\u308b\r\n    $post_views_count = (int) $post_views_count + 1;\r\n    update_post_meta($post_id, $custom_key, (string) $post_views_count);\r\n}\r\n<\/code><\/pre>\r\n<h3 class=\"fz-ml ignore-toc-scope\">\u30dd\u30a4\u30f3\u30c8<\/h3>\r\n<ul style=\"list-style-type:bullet;\" class=\"my-0.5r\">\r\n  <li><code>false<\/code> \u30c1\u30a7\u30c3\u30af\u3092 <code>=== &#39;&#39;<\/code> \u3068\u4e00\u7dd2\u306b\u8ffd\u52a0\u3059\u308b<\/li>\r\n  <li><code>(int)<\/code> \u3067\u660e\u793a\u7684\u306b\u6574\u6570\u306b\u30ad\u30e3\u30b9\u30c8\u3057\u3066\u304b\u3089\u8a08\u7b97\u3059\u308b<\/li>\r\n  <li>\u521d\u671f\u5024\u306f <code>&#39;0&#39;<\/code> \u3088\u308a <code>&#39;1&#39;<\/code> \u304c\u6b63\u3057\u3044\uff08\u521d\u56de\u95b2\u89a7\u6642\u70b9\u3067\u30ab\u30a6\u30f3\u30c81\uff09<\/li>\r\n<\/ul>\r\n\r\n<hr class=\"separator mt-3r\">\r\n\r\n<h2 class=\"fz-xl\">\u30d1\u30bf\u30fc\u30f33\uff1a<code>foreach()<\/code> \u306b null \u3092\u6e21\u3059Warning<\/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 Warning: foreach() argument must be of type array|object, null given in header.php on line 677\r\n<\/code><\/pre>\r\n<p class=\"mt-1r\"><b class=\"bold\">\u539f\u56e0<\/b><\/p>\r\n<p>\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u3092 <code>foreach<\/code> \u3057\u3066\u3044\u308b\u30b3\u30fc\u30c9\u3067\u3001\u305d\u306e\u5909\u6570\u304c\u5225\u306e\u30c6\u30fc\u30de\u304b\u3089\u8907\u88fd\u3057\u3066\u304d\u305f\u969b\u306b\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u306a\u3044\u30b1\u30fc\u30b9\u3067\u3059\u3002<\/p>\r\n<p>\u305f\u3068\u3048\u3070 \u30c6\u30fc\u30de\u306e <code>functions.php<\/code> \u306b\u306f <code>$global_session_params<\/code> \u3068\u3044\u3046\u5909\u6570\u304c\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u3066\u3082\u3001\u305d\u308c\u3092\u30b3\u30d4\u30fc\u5143\u306b\u3057\u3066\u4f5c\u3063\u305f \u30c6\u30fc\u30de\u3067\u306f\u5b9a\u7fa9\u304c\u6f0f\u308c\u3066\u3044\u305f\u3001\u3068\u3044\u3046\u30b1\u30fc\u30b9\u3002<\/p>\r\n<h3 class=\"fz-ml\">Before\uff08\u3088\u304f\u66f8\u304b\u308c\u3066\u3044\u308b\u30b3\u30fc\u30c9\uff09<\/h3>\r\n<pre><code class=\"language-php\">\/\/ header.php\r\nglobal $global_session_params;\r\nforeach ($global_session_params as $key =&gt; $value) {\r\n    $_SESSION&lsqb;$key&rsqb; = $value;\r\n}\r\n<\/code><\/pre>\r\n<p><code>$global_session_params<\/code> \u304c <code>null<\/code> \u306e\u5834\u5408\u3001PHP8\u3067\u306fWarning\u304c\u51fa\u307e\u3059\u3002<\/p>\r\n<h3 class=\"fz-ml\">After\uff08\u4fee\u6b63\u5f8c\uff09<\/h3>\r\n<pre><code class=\"language-php\">global $global_session_params;\r\nif (is_array($global_session_params)) {\r\n    foreach ($global_session_params as $key =&gt; $value) {\r\n        $_SESSION&lsqb;$key&rsqb; = $value;\r\n    }\r\n}\r\n<\/code><\/pre>\r\n<h3 class=\"fz-ml ignore-toc-scope\">\u30dd\u30a4\u30f3\u30c8<\/h3>\r\n<p><code>is_array()<\/code> \u3067\u78ba\u8a8d\u3057\u3066\u304b\u3089 <code>foreach<\/code> \u3059\u308b\u7fd2\u6163\u3092\u3064\u3051\u308b\u3068\u3001\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u304c\u672a\u5b9a\u7fa9\u306e\u5834\u5408\u3067\u3082\u5b89\u5168\u306b\u52d5\u4f5c\u3057\u307e\u3059\u3002<\/p>\r\n<p>\u30c6\u30fc\u30de\u8907\u88fd\u6642\u306b\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u306e\u5b9a\u7fa9\u304c\u6f0f\u308c\u308b\u3053\u3068\u306f\u975e\u5e38\u306b\u3088\u304f\u3042\u308a\u307e\u3059\u3002\u5b9a\u7fa9\u3092\u8ffd\u52a0\u3059\u308b\u3088\u308a\u3082\u3001\u4f7f\u7528\u5074\u3067\u9632\u5fa1\u7684\u30c1\u30a7\u30c3\u30af\u3092\u3059\u308b\u307b\u3046\u304c\u4ed6\u306e\u30c6\u30fc\u30de\u306b\u4f7f\u3044\u56de\u305b\u3066\u5b89\u5168\u3067\u3059\u3002<\/p>\r\n\r\n<hr class=\"separator mt-3r\">\r\n\r\n<h2 class=\"fz-xl\">\u30d1\u30bf\u30fc\u30f34\uff1a\u5b58\u5728\u3057\u306a\u3044 <code>$_GET<\/code> \u30ad\u30fc\u3078\u306e\u30a2\u30af\u30bb\u30b9<\/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 Warning: Undefined array key &quot;post&quot; in functions.php on line 976\r\n<\/code><\/pre>\r\n<p class=\"mt-1r\"><b class=\"bold\">\u539f\u56e0<\/b><\/p>\r\n<p>WordPress\u7ba1\u7406\u753b\u9762\u3067\u306f\u3001URL\u4e0a\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u304c<b class=\"bold\">\u30da\u30fc\u30b8\u306b\u3088\u3063\u3066\u5909\u308f\u308a\u307e\u3059<\/b>\u3002<\/p>\r\n<p>\u305f\u3068\u3048\u3070\u6295\u7a3f\u4e00\u89a7\u304b\u3089\u6295\u7a3f\u3092\u958b\u304fURL\u306f <code>\/wp-admin\/post.php?post=123&amp;action=edit<\/code> \u3067\u3059\u304c\u3001\u65b0\u898f\u6295\u7a3f\u4f5c\u6210\u306eURL\u306f <code>\/wp-admin\/post-new.php<\/code> \u3067 <code>post<\/code> \u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\r\n<p><code>$_GET&lsqb;&#39;post&#39;&rsqb;<\/code> \u3092\u76f4\u63a5\u53c2\u7167\u3057\u3066\u3044\u308b\u30b3\u30fc\u30c9\u306f\u3001<code>post<\/code> \u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u5b58\u5728\u3057\u306a\u3044\u30da\u30fc\u30b8\u3067Warning\u304c\u51fa\u307e\u3059\u3002<\/p>\r\n<h3 class=\"fz-ml\">Before\uff08\u3088\u304f\u66f8\u304b\u308c\u3066\u3044\u308b\u30b3\u30fc\u30c9\uff09<\/h3>\r\n<pre><code class=\"language-php\">function disable_visual_editor_in_page($args) {\r\n    $post_id = $_GET&lsqb;&#39;post&#39;&rsqb;;  \/\/ \u65b0\u898f\u6295\u7a3f\u753b\u9762\u3067\u306f\u5b58\u5728\u3057\u306a\u3044\r\n    $post_type = get_post_type($post_id);\r\n    if ($post_type === &#39;page&#39;) {\r\n        $args&lsqb;&#39;tinymce&#39;&rsqb; = false;\r\n    }\r\n    return $args;\r\n}\r\nadd_filter(&#39;wp_editor_settings&#39;, &#39;disable_visual_editor_in_page&#39;);\r\n<\/code><\/pre>\r\n<h3 class=\"fz-ml\">After\uff08\u4fee\u6b63\u5f8c\uff09<\/h3>\r\n<pre><code class=\"language-php\">function disable_visual_editor_in_page($args) {\r\n    if (!isset($_GET&lsqb;&#39;post&#39;&rsqb;)) {\r\n        return $args;  \/\/ post\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u306a\u3044\u3068\u304d\u306f\u4f55\u3082\u305b\u305a\u8fd4\u3059\r\n    }\r\n    $post_id = $_GET&lsqb;&#39;post&#39;&rsqb;;\r\n    $post_type = get_post_type($post_id);\r\n    if ($post_type === &#39;page&#39;) {\r\n        $args&lsqb;&#39;tinymce&#39;&rsqb; = false;\r\n    }\r\n    return $args;\r\n}\r\nadd_filter(&#39;wp_editor_settings&#39;, &#39;disable_visual_editor_in_page&#39;);\r\n<\/code><\/pre>\r\n<h3 class=\"fz-ml ignore-toc-scope\">\u30dd\u30a4\u30f3\u30c8<\/h3>\r\n<p><code>$_GET<\/code> \u3084 <code>$_POST<\/code> \u306e\u30ad\u30fc\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u524d\u306f\u3001\u5fc5\u305a <code>isset()<\/code> \u3067\u5b58\u5728\u78ba\u8a8d\u3092\u3057\u307e\u3059\u3002\u300c\u3053\u306e\u30da\u30fc\u30b8\u3067\u306f\u5fc5\u305a\u3042\u308b\u306f\u305a\u300d\u3068\u3044\u3046\u601d\u3044\u8fbc\u307f\u304cWarning\u306e\u539f\u56e0\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\r\n\r\n<hr class=\"separator mt-3r\">\r\n\r\n<h2 class=\"fz-xl\">\u30d1\u30bf\u30fc\u30f35\uff1a<code>if-elseif-else<\/code> \u306e\u5168\u5206\u5c90\u3067\u5909\u6570\u304c\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u306a\u3044<\/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 Warning: Undefined variable $pbndSml in parts\/pagecover\/pageband-elf.php on line 222\r\n<\/code><\/pre>\r\n<p class=\"mt-1r\"><b class=\"bold\">\u539f\u56e0<\/b><\/p>\r\n<p><code>if-elseif-else<\/code> \u3067\u5909\u6570\u3092\u5b9a\u7fa9\u3059\u308b\u969b\u3001\u6700\u5f8c\u306e <code>else<\/code> \u30d6\u30ed\u30c3\u30af\u3067\u5909\u6570\u306e\u5b9a\u7fa9\u304c\u6f0f\u308c\u3066\u3044\u308b\u30b1\u30fc\u30b9\u3067\u3059\u3002<\/p>\r\n<h3 class=\"fz-ml\">Before\uff08\u3088\u304f\u66f8\u304b\u308c\u3066\u3044\u308b\u30b3\u30fc\u30c9\uff09<\/h3>\r\n<pre><code class=\"language-php\">if ($page_band_style === &#39;large&#39;) {\r\n    $pbndSml = &#39;pbnd-lg&#39;;\r\n} elseif ($page_band_style === &#39;medium&#39;) {\r\n    $pbndSml = &#39;pbnd-md&#39;;\r\n}\r\n\/\/ else \u30d6\u30ed\u30c3\u30af\u304c\u306a\u3044\u3001\u307e\u305f\u306f else \u306e\u4e2d\u3067 $pbndSml \u3092\u5b9a\u7fa9\u3057\u3066\u3044\u306a\u3044\r\n\r\n\/\/ \u5f8c\u7d9a\u306e\u51e6\u7406\r\necho &#39;&lt;div class=&quot;&#39; . $pbndSml . &#39;&quot;&gt;&#39;;  \/\/ $pbndSml \u304c\u672a\u5b9a\u7fa9\u306e\u5834\u5408\u306bWarning\r\n<\/code><\/pre>\r\n<h3 class=\"fz-ml\">After\uff08\u4fee\u6b63\u5f8c\uff09<\/h3>\r\n<pre><code class=\"language-php\">if ($page_band_style === &#39;large&#39;) {\r\n    $pbndSml = &#39;pbnd-lg&#39;;\r\n} elseif ($page_band_style === &#39;medium&#39;) {\r\n    $pbndSml = &#39;pbnd-md&#39;;\r\n} else {\r\n    $pbndSml = &#39;&#39;;  \/\/ \u4e3b\u8981\u306a\u5206\u5c90\u3067\u5fc5\u305a\u5b9a\u7fa9\u3059\u308b\r\n}\r\n\r\necho &#39;&lt;div class=&quot;&#39; . $pbndSml . &#39;&quot;&gt;&#39;;\r\n<\/code><\/pre>\r\n<h3 class=\"fz-ml ignore-toc-scope\">\u30dd\u30a4\u30f3\u30c8<\/h3>\r\n<p><code>if-elseif<\/code> \u3067\u6761\u4ef6\u3092\u5217\u6319\u3059\u308b\u3068\u304d\u3001\u6700\u5f8c\u306e <code>else<\/code> \u3092\u5fd8\u308c\u3084\u3059\u3044\u3067\u3059\u3002\u5909\u6570\u3092\u4f7f\u3046\u524d\u306b\u5fc5\u305a\u521d\u671f\u5316\u3055\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\r\n<p>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u5148\u982d\u3067 <code>$pbndSml = &#39;&#39;;<\/code> \u3068\u4e8b\u524d\u306b\u521d\u671f\u5316\u3057\u3066\u304a\u304f\u65b9\u6cd5\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\r\n<pre><code class=\"language-php\">\/\/ \u30d5\u30a1\u30a4\u30eb\u306e\u5148\u982d\u3067\u521d\u671f\u5316\u3057\u3066\u304a\u304f\u65b9\u6cd5\r\n$pbndSml = &#39;&#39;;\r\n\r\nif ($page_band_style === &#39;large&#39;) {\r\n    $pbndSml = &#39;pbnd-lg&#39;;\r\n} elseif ($page_band_style === &#39;medium&#39;) {\r\n    $pbndSml = &#39;pbnd-md&#39;;\r\n}\r\n<\/code><\/pre>\r\n<p>\u3069\u3061\u3089\u306e\u66f8\u304d\u65b9\u3067\u3082\u554f\u984c\u3042\u308a\u307e\u305b\u3093\u304c\u3001\u300c\u4f7f\u3046\u524d\u306b\u5fc5\u305a\u5b9a\u7fa9\u6e08\u307f\u306e\u72b6\u614b\u306b\u3059\u308b\u300d\u3068\u3044\u3046\u610f\u8b58\u304c\u5927\u5207\u3067\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<table class=\"table my-0.5r\">\r\n  <thead>\r\n    <tr class=\"rung\">\r\n      <th>\u30d1\u30bf\u30fc\u30f3<\/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>$post-&gt;post_name<\/code> on null<\/th>\r\n      <td>\u30a2\u30fc\u30ab\u30a4\u30d6\u7b49\u3067<code>$post<\/code>\u304cnull<\/td>\r\n      <td><code>isset($post-&gt;post_name)<\/code> \u30c1\u30a7\u30c3\u30af<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th>bool increment<\/th>\r\n      <td><code>get_post_meta()<\/code>\u304cfalse\u3092\u8fd4\u3059<\/td>\r\n      <td><code>false<\/code>\u30c1\u30a7\u30c3\u30af + <code>(int)<\/code>\u30ad\u30e3\u30b9\u30c8<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><code>foreach()<\/code> null<\/th>\r\n      <td>\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u306e\u5b9a\u7fa9\u6f0f\u308c<\/td>\r\n      <td><code>is_array()<\/code> \u30c1\u30a7\u30c3\u30af<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><code>$_GET<\/code> undefined key<\/th>\r\n      <td>URL\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u5b58\u5728\u3057\u306a\u3044\u30da\u30fc\u30b8<\/td>\r\n      <td><code>isset()<\/code> \u30c1\u30a7\u30c3\u30af<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th>\u5909\u6570\u672a\u5b9a\u7fa9<\/th>\r\n      <td>\u5168\u5206\u5c90\u3067\u306e\u5b9a\u7fa9\u6f0f\u308c<\/td>\r\n      <td><code>else<\/code>\u30d6\u30ed\u30c3\u30af\u3067\u3082\u521d\u671f\u5316<\/td>\r\n    <\/tr>\r\n  <\/tbody>\r\n<\/table>\r\n<p>\u3044\u305a\u308c\u3082\u300c\u5b58\u5728\u78ba\u8a8d\u3092\u3057\u3066\u304b\u3089\u4f7f\u3046\u300d\u300c\u578b\u3092\u78ba\u8a8d\u3057\u3066\u304b\u3089\u6f14\u7b97\u3059\u308b\u300d\u3068\u3044\u3046\u30b7\u30f3\u30d7\u30eb\u306a\u5bfe\u51e6\u3067\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-fatalerror-11413\/\" class=\"linkbox my-1.5r\">\r\n<h4 class=\"linkbox-title fz-md\">WordPress\u30c6\u30fc\u30de\u306eFatal Error\u3068\u30a8\u30e9\u30fc\u306e\u9023\u9396\u69cb\u9020\u3092\u76f4\u3059\u3010PHP7\u2192PHP8\u79fb\u884c\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\/d952261dd53f8972565cf5900dee58a1.jpg?ver=20260317182839\" alt=\"WordPress\u30c6\u30fc\u30de\u306eFatal Error\u3068\u30a8\u30e9\u30fc\u306e\u9023\u9396\u69cb\u9020\u3092\u76f4\u3059\u3010PHP7\u2192PHP8\u79fb\u884c\u3011\" loading=\"lazy\" \/>\r\n<\/picture>\r\n<span class=\"linkbox-excerpt\">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...\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=20260317182839\" 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=20260317182839\" 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":"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$_GET\u306e\u5b58\u5728\u78ba\u8a8d\u30fbif-else\u306e\u5909\u6570\u5b9a\u7fa9\u6f0f\u308c\u3002functions.php\u3092\u66f8\u304f\u30ec\u30d9\u30eb\u306e\u65b9\u5411\u3051\u306b\u308f\u304b\u308a\u3084\u3059\u304f\u8aac\u660e\u3057\u3066\u3044\u307e\u3059\u3002","protected":false},"author":1,"featured_media":11411,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[779,780,781,776,772,778,173,155,102,111],"class_list":{"0":"post-11409","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-wordpress","8":"tag-isset","9":"tag-get_post_meta","10":"tag-post","11":"tag-php","12":"tag-php8","13":"tag-wordpress","14":"tag-warning","15":"tag-functions-php"},"_links":{"self":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/11409","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=11409"}],"version-history":[{"count":8,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/11409\/revisions"}],"predecessor-version":[{"id":11426,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/11409\/revisions\/11426"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media\/11411"}],"wp:attachment":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media?parent=11409"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/categories?post=11409"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/tags?post=11409"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}