{"id":9560,"date":"2026-03-17T17:06:53","date_gmt":"2026-03-17T08:06:53","guid":{"rendered":"https:\/\/code-plus.jp\/gp\/?p=9560"},"modified":"2026-03-17T17:39:15","modified_gmt":"2026-03-17T08:39:15","slug":"error-null-9560","status":"publish","type":"post","link":"https:\/\/code-plus.jp\/gp\/error-null-9560\/","title":{"rendered":"WordPress $post\u5909\u6570\u306enull\u30a8\u30e9\u30fc\u3092\u5b8c\u5168\u89e3\u6c7a\uff01<br>error_log\u3092\u7dba\u9e97\u306b\u3059\u308b\u5b9f\u8df5\u7684\u4fee\u6b63\u30ac\u30a4\u30c9"},"content":{"rendered":"<p>error_log\u3092\u78ba\u8a8d\u3059\u308b\u3068\u3001\u3053\u3093\u306a\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u5927\u91cf\u306b\u8a18\u9332\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u304b\uff1f<\/p>\r\n\r\n<pre><code class=\"language-\">PHP Warning: Attempt to read property &quot;ID&quot; on null\r\nPHP Warning: Attempt to read property &quot;post_name&quot; on null\r\nPHP Warning: Undefined variable $post\r\nPHP Warning:  Undefined array key \"post\"\r\n<\/code><\/pre>\r\n<p>\u3053\u308c\u3089\u306f\u3001 <b class=\"fw-600\"><code>$post\u5909\u6570<\/code>, <code>$_GET['post']<\/code> \u304c\u5b58\u5728\u3057\u306a\u3044\u72b6\u614b\u3067\u30a2\u30af\u30bb\u30b9\u3057\u3088\u3046\u3068\u3057\u305f\u969b\u306b\u767a\u751f\u3059\u308b\u30a8\u30e9\u30fc<\/b> \u3067\u3059\u3002\u672c\u8a18\u4e8b\u3067\u306f\u3001\u3053\u308c\u3089\u306e\u30a8\u30e9\u30fc\u3092\u6839\u672c\u304b\u3089\u89e3\u6c7a\u3059\u308b\u65b9\u6cd5\u3092\u89e3\u8aac\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=\"rule-hory mt-3r\">\r\n\r\n\r\n\r\n\r\n\r\n\r\n<h2 class=\"fz-xl\">1. \u306a\u305c$post\u304cnull\u306b\u306a\u308b\u306e\u304b<\/h2>\r\n\r\n<h3 class=\"fz-ml\">$post\u304cnull\u306b\u306a\u308b\u4e3b\u306a\u30b1\u30fc\u30b9<\/h3>\r\n<p>WordPress \u306e <code>$post<\/code> \u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u72b6\u6cc1\u3067 <code>null<\/code> \u307e\u305f\u306f\u672a\u5b9a\u7fa9\u306b\u306a\u308a\u307e\u3059\uff1a<\/p>\r\n<table class=\"table tbl-responsive\">\r\n  <thead>\r\n    <tr class=\"rung\">\r\n      <th>\u30b1\u30fc\u30b9<\/th>\r\n      <td>\u8aac\u660e<\/td>\r\n    <\/tr>\r\n  <\/thead>\r\n  <tbody>\r\n    <tr class=\"rung\">\r\n      <th><b class=\"fw-600\">\u30a2\u30fc\u30ab\u30a4\u30d6\u30da\u30fc\u30b8<\/b><\/th>\r\n      <td>\u30ab\u30c6\u30b4\u30ea\u30fc\u3001\u30bf\u30b0\u3001\u65e5\u4ed8\u30a2\u30fc\u30ab\u30a4\u30d6\u306a\u3069<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><b class=\"fw-600\">404\u30da\u30fc\u30b8<\/b><\/th>\r\n      <td>\u5b58\u5728\u3057\u306a\u3044URL\u306b\u30a2\u30af\u30bb\u30b9\u3057\u305f\u5834\u5408<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><b class=\"fw-600\">\u691c\u7d22\u7d50\u679c\u30da\u30fc\u30b8<\/b><\/th>\r\n      <td>\u7279\u5b9a\u306e\u6295\u7a3f\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u304c\u306a\u3044<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><b class=\"fw-600\">\u30ab\u30b9\u30bf\u30e0\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8<\/b><\/th>\r\n      <td>\u30eb\u30fc\u30d7\u5916\u3067<code>$post<\/code>\u3092\u53c2\u7167\u3057\u305f\u5834\u5408<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><b class=\"fw-600\">\u95a2\u6570\u5185\u90e8<\/b><\/th>\r\n      <td><code>global $post;<\/code> \u5ba3\u8a00\u306a\u3057\u3067\u4f7f\u7528<\/td>\r\n    <\/tr>\r\n  <\/tbody>\r\n<\/table>\r\n\r\n<h3 class=\"fz-ml\">\u30a8\u30e9\u30fc\u304c\u983b\u767a\u3059\u308b\u7406\u7531<\/h3>\r\n<p>\u591a\u304f\u306e\u30c6\u30fc\u30de\u3067\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u300c\u5371\u967a\u306a\u30b3\u30fc\u30c9\u300d\u304c\u6563\u5728\u3057\u3066\u3044\u307e\u3059\uff1a<\/p>\r\n<pre><code class=\"language-php\">\/\/ \u274c \u5371\u967a\uff1a$post\u306e\u5b58\u5728\u78ba\u8a8d\u306a\u3057\r\n$slug = $post-&gt;post_name;\r\n$custom_field = get_post_meta($post-&gt;ID, &#39;key&#39;, true);\r\n<\/code><\/pre>\r\n<p>\u3053\u308c\u3089\u306f\u6295\u7a3f\u30fb\u56fa\u5b9a\u30da\u30fc\u30b8\u3067\u306f\u52d5\u4f5c\u3057\u307e\u3059\u304c\u3001\u30a2\u30fc\u30ab\u30a4\u30d6\u30da\u30fc\u30b8\u3084404\u30da\u30fc\u30b8\u3067\u30a8\u30e9\u30fc\u3092\u5f15\u304d\u8d77\u3053\u3057\u307e\u3059\u3002<\/p>\r\n<hr class=\"rule-hory mt-3r\">\r\n\r\n\r\n<h2 class=\"fz-xl\">2. \u3088\u304f\u3042\u308b\u30a8\u30e9\u30fc\u30d1\u30bf\u30fc\u30f3<\/h2>\r\n\r\n<h3 class=\"fz-ml\">\u30d1\u30bf\u30fc\u30f31: post_name\u3078\u306e\u76f4\u63a5\u30a2\u30af\u30bb\u30b9<\/h3>\r\n<p><b class=\"fw-600\">\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8:<\/b><\/p>\r\n<pre><code class=\"language-\">PHP Warning: Attempt to read property &quot;post_name&quot; on null\r\n<\/code><\/pre>\r\n<p><b class=\"fw-600\">\u554f\u984c\u306e\u3042\u308b\u30b3\u30fc\u30c9:<\/b><\/p>\r\n<pre><code class=\"language-php\">$slug = $post-&gt;post_name;\r\n<\/code><\/pre>\r\n<p><b class=\"fw-600\">\u4fee\u6b63\u5f8c:<\/b><\/p>\r\n<pre><code class=\"language-php\">global $post;\r\n$slug = isset($post-&gt;post_name) ? $post-&gt;post_name : &#39;&#39;;\r\n<\/code><\/pre>\r\n<hr class=\"rule-hory mt-3r\">\r\n\r\n<h3 class=\"fz-ml\">\u30d1\u30bf\u30fc\u30f32: ID\u3092\u4f7f\u3063\u305fget_post_meta()<\/h3>\r\n<p><b class=\"fw-600\">\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8:<\/b><\/p>\r\n<pre><code class=\"language-\">PHP Warning: Attempt to read property &quot;ID&quot; on null\r\n<\/code><\/pre>\r\n<p><b class=\"fw-600\">\u554f\u984c\u306e\u3042\u308b\u30b3\u30fc\u30c9:<\/b><\/p>\r\n<pre><code class=\"language-php\">$custom_description = get_post_meta($post-&gt;ID, &#39;_meta_description&#39;, true);\r\n<\/code><\/pre>\r\n<p><b class=\"fw-600\">\u4fee\u6b63\u5f8c:<\/b><\/p>\r\n<pre><code class=\"language-php\">global $post;\r\nif ($post &amp;&amp; isset($post-&gt;ID)) {\r\n    $custom_description = get_post_meta($post-&gt;ID, &#39;_meta_description&#39;, true);\r\n    if (!empty($custom_description)) {\r\n        return $custom_description;\r\n    }\r\n}\r\n<\/code><\/pre>\r\n<hr class=\"rule-hory mt-3r\">\r\n\r\n<h3 class=\"fz-ml\">\u30d1\u30bf\u30fc\u30f33: get_post_ancestors()\u3067\u306e\u4f7f\u7528<\/h3>\r\n<p><b class=\"fw-600\">\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8:<\/b><\/p>\r\n<pre><code class=\"language-\">PHP Warning: Undefined variable $post\r\n<\/code><\/pre>\r\n<p><b class=\"fw-600\">\u554f\u984c\u306e\u3042\u308b\u30b3\u30fc\u30c9:<\/b><\/p>\r\n<pre><code class=\"language-php\">$ancestors_ids = array_reverse(get_post_ancestors($post));\r\n<\/code><\/pre>\r\n<p><b class=\"fw-600\">\u4fee\u6b63\u5f8c:<\/b><\/p>\r\n<pre><code class=\"language-php\">global $post;\r\nif ($post &amp;&amp; isset($post-&gt;ID)) {\r\n    $ancestors_ids = array_reverse(get_post_ancestors($post));\r\n    foreach ($ancestors_ids as $ancestors_id) {\r\n        \/\/ \u51e6\u7406\r\n    }\r\n}\r\n<\/code><\/pre>\r\n<hr class=\"rule-hory mt-3r\">\r\n\r\n<h3 class=\"fz-ml\">\u30d1\u30bf\u30fc\u30f34: \u30ab\u30c6\u30b4\u30ea\u30fc\u914d\u5217\u3078\u306e\u76f4\u63a5\u30a2\u30af\u30bb\u30b9<\/h3>\r\n<p><b class=\"fw-600\">\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8:<\/b><\/p>\r\n<pre><code class=\"language-\">PHP Warning: Trying to access array offset on value of type bool\r\n<\/code><\/pre>\r\n<p><b class=\"fw-600\">\u554f\u984c\u306e\u3042\u308b\u30b3\u30fc\u30c9:<\/b><\/p>\r\n<pre><code class=\"language-php\">$category = get_the_category();\r\n$cat_name = $category[0]-&gt;cat_name;\r\n<\/code><\/pre>\r\n<p><b class=\"fw-600\">\u4fee\u6b63\u5f8c:<\/b><\/p>\r\n<pre><code class=\"language-php\">if (has_category()) {\r\n    $category = get_the_category();\r\n    if (!empty($category)) {\r\n        $cat_id = $category[0]-&gt;cat_ID;\r\n        $cat_link = get_category_link($cat_id);\r\n        $cat_slug = $category[0]-&gt;category_nicename;\r\n        $cat_name = $category[0]-&gt;cat_name;\r\n    }\r\n}\r\n<\/code><\/pre>\r\n<hr class=\"rule-hory mt-3r\">\r\n\r\n<h3 class=\"fz-ml\">\u30d1\u30bf\u30fc\u30f35: \u30bf\u30b0\u914d\u5217\u3078\u306e\u76f4\u63a5\u30a2\u30af\u30bb\u30b9<\/h3>\r\n<p><b class=\"fw-600\">\u554f\u984c\u306e\u3042\u308b\u30b3\u30fc\u30c9:<\/b><\/p>\r\n<pre><code class=\"language-php\">$posttags = get_the_tags();\r\n$tag_name = $posttags[0]-&gt;name;\r\n<\/code><\/pre>\r\n<p><b class=\"fw-600\">\u4fee\u6b63\u5f8c:<\/b><\/p>\r\n<pre><code class=\"language-php\">if (has_tag()) {\r\n    $posttags = get_the_tags();\r\n    if (!empty($posttags)) {\r\n        $tag_name = $posttags[0]-&gt;name;\r\n        $tag_id = $posttags[0]-&gt;term_id;\r\n        $tag_link = get_tag_link($tag_id);\r\n    }\r\n}\r\n<\/code><\/pre>\r\n<hr class=\"rule-hory mt-3r\">\r\n\r\n<h3 class=\"fz-ml\">\u30d1\u30bf\u30fc\u30f36: $_GET\u914d\u5217\u3078\u306e\u76f4\u63a5\u30a2\u30af\u30bb\u30b9\uff08\u7ba1\u7406\u753b\u9762\uff09<\/h3>\r\n<p><b class=\"fw-600\">\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8:<\/b><\/p>\r\n<pre><code class=\"language-\">PHP Warning: Undefined array key &quot;post&quot; in admin-style.php\r\n<\/code><\/pre>\r\n<p><b class=\"fw-600\">\u554f\u984c\u306e\u3042\u308b\u30b3\u30fc\u30c9:<\/b><\/p>\r\n<pre><code class=\"language-php\">function disable_visual_editor_in_page() {\r\n    global $typenow;\r\n    $post_id = $_GET[&#39;post&#39;]; \/\/\u274c \u65b0\u898f\u4f5c\u6210\u6642\u306b\u5b58\u5728\u3057\u306a\u3044\r\n    \r\n    if ($typenow == &#39;page&#39;) {\r\n        if (!in_array($post_id, array(&#39;1&#39;, &#39;2&#39;), true)) {\r\n            add_filter(&#39;user_can_richedit&#39;, &#39;disable_visual_editor_filter&#39;);\r\n        }\r\n    }\r\n}\r\n<\/code><\/pre>\r\n<p><b class=\"fw-600\">\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b\u30bf\u30a4\u30df\u30f3\u30b0:<\/b><\/p>\r\n<ul style=\"list-style-type:bullet;\">\r\n<li>\u7ba1\u7406\u753b\u9762\u3067\u300c\u65b0\u898f\u6295\u7a3f\u3092\u8ffd\u52a0\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u6642<\/li>\r\n<li><code>$_GET[&#39;post&#39;]<\/code> \u306f\u7de8\u96c6\u6642\u306e\u307f\u5b58\u5728\u3057\u3001\u65b0\u898f\u4f5c\u6210\u6642\u306f\u672a\u5b9a\u7fa9<\/li>\r\n<\/ul>\r\n\r\n<p><b class=\"fw-600\">\u4fee\u6b63\u5f8c\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u8a2d\u5b9a\uff09:<\/b><\/p>\r\n<pre><code class=\"language-php\">function disable_visual_editor_in_page() {\r\n    global $typenow;\r\n    \r\n    \/\/\u6295\u7a3fID\u3092\u53d6\u5f97\uff08\u7de8\u96c6\u6642\u306e\u307f\u3001\u65b0\u898f\u4f5c\u6210\u6642\u306f0\uff09\r\n    $post_id = isset($_GET[&#39;post&#39;]) ? intval($_GET[&#39;post&#39;]) : 0;\r\n    \r\n    \/\/\u65b0\u898f\u4f5c\u6210\u6642\uff08$post_id = 0\uff09\u306f\u4f55\u3082\u3057\u306a\u3044\r\n    if ($post_id === 0) {\r\n        return;\r\n    }\r\n\r\n    \/\/\u7279\u5b9a\u306e\u56fa\u5b9a\u30da\u30fc\u30b8\u3067\u306e\u307f\u30d3\u30b8\u30e5\u30a2\u30eb\u30a8\u30c7\u30a3\u30bf\u3092\u3010\u8868\u793a\u3011\r\n    if ($typenow == &#39;page&#39;) {\r\n        if (!in_array($post_id, array(1, 2), true)) {\r\n            add_filter(&#39;user_can_richedit&#39;, &#39;disable_visual_editor_filter&#39;);\r\n        }\r\n    }\r\n}\r\n<\/code><\/pre>\r\n\r\n<p><b class=\"fw-600\">\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5411\u4e0a\u306e\u30dd\u30a4\u30f3\u30c8:<\/b><\/p>\r\n<ul style=\"list-style-type:bullet;\">\r\n<li><code>intval()<\/code> \u3067\u6574\u6570\u306b\u5909\u63db<\/li>\r\n<li>\u6587\u5b57\u5217 <code>&#39;1&#39;<\/code> \u3067\u306f\u306a\u304f\u6574\u6570 <code>1<\/code> \u3067\u6bd4\u8f03<\/li>\r\n<\/ul>\r\n<p><b class=\"fw-600\">\u9069\u7528\u3059\u308b\u30d5\u30c3\u30af:<\/b><\/p>\r\n<pre><code class=\"language-php\">add_action(&#39;load-post.php&#39;, &#39;disable_visual_editor_in_page&#39;);      \/\/\u7de8\u96c6\u753b\u9762\r\nadd_action(&#39;load-post-new.php&#39;, &#39;disable_visual_editor_in_page&#39;);  \/\/\u65b0\u898f\u4f5c\u6210\u753b\u9762\r\n<\/code><\/pre>\r\n<hr class=\"rule-hory mt-3r\">\r\n<p><b class=\"fw-600\">\u3053\u306e\u30d1\u30bf\u30fc\u30f3\u304c\u8a72\u5f53\u3059\u308b\u5834\u6240:<\/b><\/p>\r\n<ul style=\"list-style-type:bullet;\">\r\n<li><code>admin-style.php<\/code><\/li>\r\n<li>\u30ab\u30b9\u30bf\u30e0\u7ba1\u7406\u753b\u9762\u306e\u30b3\u30fc\u30c9<\/li>\r\n<li><code>$_GET<\/code>\u3001<code>$_POST<\/code>\u3001<code>$_REQUEST<\/code> \u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u7b87\u6240<\/li>\r\n<\/ul>\r\n<hr class=\"rule-hory mt-3r\">\r\n\r\n\r\n\r\n<h2 class=\"fz-xl\">3. \u57fa\u672c\u7684\u306a\u4fee\u6b63\u65b9\u6cd5<\/h2>\r\n\r\n<h3 class=\"fz-ml\">\u9244\u52471: \u5fc5\u305a\u5b58\u5728\u78ba\u8a8d\u3092\u3059\u308b<\/h3>\r\n<pre><code class=\"language-php\">\/\/ \u274c NG\r\n$value = $post-&gt;post_name;\r\n\r\n\/\/ \u2705 OK\r\nif ($post &amp;&amp; isset($post-&gt;post_name)) {\r\n    $value = $post-&gt;post_name;\r\n}\r\n<\/code><\/pre>\r\n\r\n<h3 class=\"fz-ml\">\u9244\u52472: global\u5ba3\u8a00\u3092\u5fd8\u308c\u306a\u3044<\/h3>\r\n<p>\u95a2\u6570\u5185\u3084\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\u3067<code>$post<\/code>\u3092\u4f7f\u3046\u5834\u5408\uff1a<\/p>\r\n<pre><code class=\"language-php\">function my_custom_function() {\r\n    global $post; \/\/ \ud83d\udc48 \u3053\u308c\u3092\u5fd8\u308c\u305a\u306b\uff01\r\n    \r\n    if ($post &amp;&amp; isset($post-&gt;ID)) {\r\n        \/\/ \u51e6\u7406\r\n    }\r\n}\r\n<\/code><\/pre>\r\n\r\n<h3 class=\"fz-ml\">\u9244\u52473: \u914d\u5217\u306f\u7a7a\u30c1\u30a7\u30c3\u30af\u3092\u884c\u3046<\/h3>\r\n<pre><code class=\"language-php\">\/\/ \u274c NG\r\n$category = get_the_category();\r\n$name = $category[0]-&gt;cat_name;\r\n\r\n\/\/ \u2705 OK\r\n$category = get_the_category();\r\nif (!empty($category)) {\r\n    $name = $category[0]-&gt;cat_name;\r\n}\r\n<\/code><\/pre>\r\n<hr class=\"rule-hory mt-3r\">\r\n\r\n\r\n<h2 class=\"fz-xl\">4. \u30d5\u30a1\u30a4\u30eb\u5225\u306e\u5177\u4f53\u7684\u306a\u4fee\u6b63\u4f8b<\/h2>\r\n\r\n<h3 class=\"fz-ml\">header.php \u306e\u4fee\u6b63<\/h3>\r\n<p><b class=\"fw-600\">\u4fee\u6b63\u7b87\u6240: \u30e1\u30bf\u30c7\u30a3\u30b9\u30af\u30ea\u30d7\u30b7\u30e7\u30f3\u751f\u6210\u95a2\u6570<\/b><\/p>\r\n<pre><code class=\"language-php\">&lt;?php\r\nfunction generate_meta_description() {\r\n    global $post;\r\n    \r\n    $site_name = get_bloginfo(&#39;name&#39;);\r\n    $page_title = is_home() || is_front_page() ? &#39;&#39; : get_the_title();\r\n    \r\n    \/\/ \u30ab\u30b9\u30bf\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u53d6\u5f97\uff08\u5b89\u5168\u306b\uff09\r\n    if ($post &amp;&amp; isset($post-&gt;ID)) {\r\n        $custom_description = get_post_meta($post-&gt;ID, &#39;_meta_description&#39;, true);\r\n        if (!empty($custom_description)) {\r\n            return $custom_description;\r\n        }\r\n    }\r\n    \r\n    \/\/ \u629c\u7c8b\u306e\u53d6\u5f97\r\n    if ($post &amp;&amp; has_excerpt()) {\r\n        return get_the_excerpt();\r\n    }\r\n    \r\n    \/\/ \u30c7\u30d5\u30a9\u30eb\u30c8\r\n    if (!empty($page_title)) {\r\n        return &quot;{$site_name}\u306e{$page_title}\u30da\u30fc\u30b8\u3067\u3059\u3002&quot;;\r\n    } else {\r\n        return get_bloginfo(&#39;description&#39;);\r\n    }\r\n}\r\n?&gt;\r\n<\/code><\/pre>\r\n<p><b class=\"fw-600\">\u4fee\u6b63\u7b87\u6240: body_class\u3078\u306e\u30ab\u30b9\u30bf\u30e0\u30bf\u30af\u30bd\u30ce\u30df\u30fc\u8ffd\u52a0<\/b><\/p>\r\n<pre><code class=\"language-php\">&lt;?php\r\n\/* \u30da\u30fc\u30b8\u30bf\u30b0\uff08CPT UI\uff09\u30af\u30e9\u30b9\u3092\u3001body_class \u306b\u8ffd\u52a0 *\/\r\nif (is_singular()) {\r\n    $term_slug_pg = &#39;&#39;;\r\n    global $post;\r\n    if (isset($post) &amp;&amp; $post) {\r\n        $terms_pg = get_the_terms($post-&gt;ID, &#39;pg&#39;);\r\n        if ($terms_pg &amp;&amp; !is_wp_error($terms_pg)) {\r\n            foreach ($terms_pg as $term_pg) {\r\n                $term_slug_pg = $term_pg-&gt;slug;\r\n            }\r\n        }\r\n    }\r\n}\r\n?&gt;\r\n<\/code><\/pre>\r\n<hr class=\"rule-hory mt-3r\">\r\n\r\n<h3 class=\"fz-ml\">index.php \u306e\u4fee\u6b63<\/h3>\r\n<p><b class=\"fw-600\">\u4fee\u6b63\u524d:<\/b><\/p>\r\n<pre><code class=\"language-php\">&lt;?php\r\n$slug = $post-&gt;post_name;\r\nif (has_category()) {\r\n    $category = get_the_category();\r\n    $cat_id = $category[0]-&gt;cat_ID;\r\n    $cat_name = $category[0]-&gt;cat_name;\r\n}\r\n?&gt;\r\n<\/code><\/pre>\r\n<p><b class=\"fw-600\">\u4fee\u6b63\u5f8c:<\/b><\/p>\r\n<pre><code class=\"language-php\">&lt;?php\r\nglobal $post;\r\n$slug = isset($post-&gt;post_name) ? $post-&gt;post_name : &#39;&#39;;\r\n\r\nif (has_category()) {\r\n    $category = get_the_category();\r\n    if (!empty($category)) {\r\n        $cat_id = $category[0]-&gt;cat_ID;\r\n        $cat_link = get_category_link($cat_id);\r\n        $cat_slug = $category[0]-&gt;category_nicename;\r\n        $cat_name = $category[0]-&gt;cat_name;\r\n    }\r\n}\r\n\r\nif (has_tag()) {\r\n    $posttags = get_the_tags();\r\n    if (!empty($posttags)) {\r\n        $tag_name = $posttags[0]-&gt;name;\r\n        $tag_id = $posttags[0]-&gt;term_id;\r\n        $tag_link = get_tag_link($tag_id);\r\n    }\r\n}\r\n?&gt;\r\n<\/code><\/pre>\r\n<hr class=\"rule-hory mt-3r\">\r\n\r\n<h3 class=\"fz-ml\">single.php \/ page.php \u306e\u4fee\u6b63<\/h3>\r\n<p><b class=\"fw-600\">\u4fee\u6b63\u524d:<\/b><\/p>\r\n<pre><code class=\"language-php\">&lt;?php\r\n$slug = $post-&gt;post_name;\r\nif (has_category()) {\r\n    $category = get_the_category();\r\n    $cat_name = $category[0]-&gt;cat_name;\r\n}\r\n?&gt;\r\n<\/code><\/pre>\r\n<p><b class=\"fw-600\">\u4fee\u6b63\u5f8c:<\/b><\/p>\r\n<pre><code class=\"language-php\">&lt;?php\r\nglobal $post;\r\n$slug = isset($post-&gt;post_name) ? $post-&gt;post_name : &#39;&#39;;\r\n\r\nif (has_category()) {\r\n    $categories = get_the_category();\r\n    if (!empty($categories)) {\r\n        $category = $categories[0];\r\n        $cat_id = $category-&gt;cat_ID;\r\n        $cat_link = get_category_link($cat_id);\r\n        $cat_slug = $category-&gt;category_nicename;\r\n        $cat_name = $category-&gt;cat_name;\r\n    }\r\n}\r\n\r\nif (has_tag()) {\r\n    $posttags = get_the_tags();\r\n    if (!empty($posttags)) {\r\n        $tag_name = $posttags[0]-&gt;name;\r\n        $tag_id = $posttags[0]-&gt;term_id;\r\n        $tag_link = get_tag_link($tag_id);\r\n    }\r\n}\r\n?&gt;\r\n<\/code><\/pre>\r\n<hr class=\"rule-hory mt-3r\">\r\n\r\n<h3 class=\"fz-ml\">breadcrumb.php \u306e\u4fee\u6b63<\/h3>\r\n<p>\u30d1\u30f3\u304f\u305a\u30ea\u30b9\u30c8\u3067\u3082<code>$post<\/code>\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u3001\u30d5\u30a1\u30a4\u30eb\u306e\u5192\u982d\u3067\u5ba3\u8a00\uff1a<\/p>\r\n<pre><code class=\"language-php\">&lt;!-- breadcrumb.php --&gt;\r\n&lt;?php global $post; ?&gt;\r\n&lt;nav class=&quot;breadcrumb leckermaul mx-auto py-0.5r&quot;&gt;\r\n  &lt;ul class=&quot;breadcrumb-wrapper&quot;&gt;\r\n    &lt;li&gt;&lt;a href=&quot;&lt;?php echo home_url(&#39;\/&#39;); ?&gt;&quot;&gt;&lt;i&gt;&lt;\/i&gt;\u30c8\u30c3\u30d7&lt;\/a&gt;&lt;\/li&gt;\r\n    \r\n    &lt;?php if (is_single() &amp;&amp; get_post_type() === &#39;post&#39; &amp;&amp; !is_404()) : ?&gt;\r\n      &lt;!-- \u6295\u7a3f\u30da\u30fc\u30b8\u306e\u51e6\u7406 --&gt;\r\n    &lt;?php else : ?&gt;\r\n      &lt;!-- \u56fa\u5b9a\u30da\u30fc\u30b8\u306e\u51e6\u7406 --&gt;\r\n      &lt;?php\r\n      if ($post &amp;&amp; has_category()) {\r\n          $ancestors_ids = array_reverse(get_post_ancestors($post));\r\n          foreach ($ancestors_ids as $ancestors_id) {\r\n              echo &#39;&lt;li&gt;&lt;a href=&quot;&#39; . get_page_link($ancestors_id) . &#39;&quot;&gt;&#39;;\r\n              echo wp_strip_all_tags(get_page($ancestors_id)-&gt;post_title, false);\r\n              echo &#39;&lt;\/a&gt;&lt;\/li&gt;&#39;;\r\n          }\r\n      }\r\n      ?&gt;\r\n    &lt;?php endif; ?&gt;\r\n  &lt;\/ul&gt;\r\n&lt;\/nav&gt;\r\n<\/code><\/pre>\r\n<hr class=\"rule-hory mt-3r\">\r\n\r\n\r\n<h2 class=\"fz-xl\">5. \u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u3067\u4e00\u5143\u7ba1\u7406\u3059\u308b\u65b9\u6cd5<\/h2>\r\n\r\n<h3 class=\"fz-ml\">functions.php \u3067\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u3092\u8a2d\u5b9a<\/h3>\r\n<p>\u540c\u3058\u30b3\u30fc\u30c9\u3092\u5404\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306b\u66f8\u304f\u306e\u306f\u975e\u52b9\u7387\u3067\u3059\u3002<code>functions.php<\/code> \u3067\u4e00\u5143\u7ba1\u7406\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\r\n<p><b class=\"fw-600\">shortcodes.php\uff08functions\u5185\uff1ainclude(&#39;~\/shortcodes.php&#39;);\uff09 \u306b\u8ffd\u52a0:<\/b><\/p>\r\n<pre><code class=\"language-php\">&lt;?php\r\n\/* \u25a0 \u6295\u7a3f\u60c5\u5831\u306e\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u3092\u8a2d\u5b9a\r\n\u0fd0\u0f36\u22b0\u27e1\u22b1\u0f36\u22b0\u27e1\u22b1\u0f36\u22b0\u27e1\u22b1\u0f36\u2740\u0f36\u22b0\u27e1\u22b1\u0f36\u22b0\u27e1\u22b1\u0f36\u22b0\u27e1\u22b1\u0f36\u0f04 *\/\r\nfunction setup_global_post_variables() {\r\n    global $post;\r\n    global \r\n        $slug,  \/\/\u30b9\u30e9\u30c3\u30b0\r\n        $cat_id, $cat_link, $cat_slug, $cat_name,  \/\/\u30ab\u30c6\u30b4\u30ea\u30fc\r\n        $tag_id, $tag_link, $tag_name;  \/\/\u30bf\u30b0\r\n    \r\n    \/\/ $post\u304c\u5b58\u5728\u3059\u308b\u304b\u78ba\u8a8d\r\n    if (!isset($post) || !$post) {\r\n        return;\r\n    }\r\n    \r\n    \/\/ \u30b9\u30e9\u30c3\u30b0\u306e\u53d6\u5f97\r\n    $slug = isset($post-&gt;post_name) ? $post-&gt;post_name : &#39;&#39;;\r\n    \r\n    \/\/ \u30ab\u30c6\u30b4\u30ea\u30fc\u306e\u53d6\u5f97\r\n    if (has_category()) {\r\n        $categories = get_the_category();\r\n        if (!empty($categories)) {\r\n            $category = $categories[0];\r\n            $cat_id = $category-&gt;cat_ID;\r\n            $cat_link = get_category_link($cat_id);\r\n            $cat_slug = $category-&gt;category_nicename;\r\n            $cat_name = $category-&gt;cat_name;\r\n        }\r\n    }\r\n    \r\n    \/\/ \u30bf\u30b0\u306e\u53d6\u5f97\r\n    if (has_tag()) {\r\n        $posttags = get_the_tags();\r\n        if (!empty($posttags)) {\r\n            $tag_name = $posttags[0]-&gt;name;\r\n            $tag_id = $posttags[0]-&gt;term_id;\r\n            $tag_link = get_tag_link($tag_id);\r\n        }\r\n    }\r\n}\r\nadd_action(&#39;template_redirect&#39;, &#39;setup_global_post_variables&#39;);\r\n?&gt;\r\n<\/code><\/pre>\r\n\r\n<h3 class=\"fz-ml\">\u5404\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067\u306e\u4f7f\u7528\u65b9\u6cd5<\/h3>\r\n<p>\u4e0a\u8a18\u306e\u8a2d\u5b9a\u5f8c\u3001\u5404\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\u3067\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u7c21\u6f54\u306b\u66f8\u3051\u307e\u3059\uff1a<\/p>\r\n<pre><code class=\"language-php\">&lt;?php\r\n\/\/\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\r\nglobal \r\n    $slug,  \/\/\u30b9\u30e9\u30c3\u30b0\r\n    $cat_id, $cat_link, $cat_slug, $cat_name,  \/\/\u30ab\u30c6\u30b4\u30ea\u30fc\r\n    $tag_id, $tag_link, $tag_name;  \/\/\u30bf\u30b0\r\n?&gt;\r\n\r\n&lt;!-- \u3053\u308c\u3060\u3051\u3067OK\uff01 --&gt;\r\n&lt;h1&gt;&lt;?php echo $cat_name; ?&gt;&lt;\/h1&gt;\r\n<\/code><\/pre>\r\n<hr class=\"rule-hory mt-3r\">\r\n\r\n\r\n<h2 class=\"fz-xl\">6. \u4e00\u62ec\u4fee\u6b63\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8<\/h2>\r\n\r\n<h3 class=\"fz-ml\">\u30b9\u30c6\u30c3\u30d71: \u30a8\u30e9\u30fc\u30ed\u30b0\u3092\u78ba\u8a8d<\/h3>\r\n<pre><code class=\"language-bash\"># \u30a8\u30e9\u30fc\u30ed\u30b0\u306e\u5834\u6240\u3092\u78ba\u8a8d\r\ntail -f \/path\/to\/error_log\r\n<\/code><\/pre>\r\n\r\n<h3 class=\"fz-ml\">\u30b9\u30c6\u30c3\u30d72: \u691c\u7d22\u30d1\u30bf\u30fc\u30f3\u3067\u554f\u984c\u7b87\u6240\u3092\u7279\u5b9a<\/h3>\r\n<p>\u4ee5\u4e0b\u306e\u30d1\u30bf\u30fc\u30f3\u3092\u30c6\u30fc\u30de\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5168\u4f53\u3067\u691c\u7d22\uff1a<\/p>\r\n<ul style=\"list-style-type:bullet;\">\r\n  <li><code>$post-&gt;post_name<\/code><\/li>\r\n  <li><code>$post-&gt;ID<\/code><\/li>\r\n  <li><code>get_post_meta($post<\/code><\/li>\r\n  <li><code>get_post_ancestors($post<\/code><\/li>\r\n  <li><code>get_the_category()[0]<\/code><\/li>\r\n  <li><code>get_the_tags()[0]<\/code><\/li>\r\n<\/ul>\r\n\r\n<h3 class=\"fz-ml\">\u30b9\u30c6\u30c3\u30d73: \u30d5\u30a1\u30a4\u30eb\u3054\u3068\u306b\u4fee\u6b63<\/h3>\r\n<table class=\"table tbl-responsive\">\r\n  <thead>\r\n    <tr class=\"rung\">\r\n      <th>\u30d5\u30a1\u30a4\u30eb<\/th>\r\n      <td>\u4fee\u6b63\u5185\u5bb9<\/td>\r\n    <\/tr>\r\n  <\/thead>\r\n  <tbody>\r\n    <tr class=\"rung\">\r\n      <th><b class=\"fw-600\">header.php<\/b><\/th>\r\n      <td>\u30e1\u30bf\u30c7\u30a3\u30b9\u30af\u30ea\u30d7\u30b7\u30e7\u30f3\u751f\u6210\u95a2\u6570\u3092\u4fee\u6b63<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><b class=\"fw-600\">index.php<\/b><\/th>\r\n      <td>\u30b9\u30e9\u30c3\u30b0\u30fb\u30ab\u30c6\u30b4\u30ea\u30fc\u30fb\u30bf\u30b0\u53d6\u5f97\u3092\u4fee\u6b63<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><b class=\"fw-600\">single.php<\/b><\/th>\r\n      <td>\u540c\u4e0a<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><b class=\"fw-600\">page.php<\/b><\/th>\r\n      <td>\u540c\u4e0a<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><b class=\"fw-600\">breadcrumb.php<\/b><\/th>\r\n      <td><code>global $post;<\/code> \u3092\u8ffd\u52a0<\/td>\r\n    <\/tr>\r\n    <tr class=\"rung\">\r\n      <th><b class=\"fw-600\">parts\/*.php<\/b><\/th>\r\n      <td>\u5404\u30d1\u30fc\u30c4\u30d5\u30a1\u30a4\u30eb\u3092\u78ba\u8a8d<\/td>\r\n    <\/tr>\r\n  <\/tbody>\r\n<\/table>\r\n\r\n<h3 class=\"fz-ml\">\u30b9\u30c6\u30c3\u30d74: \u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\u95a2\u6570\u3092\u4fee\u6b63<\/h3>\r\n<p><b class=\"fw-600\">shortcodes.php \u5185\u306e\u4fee\u6b63\u4f8b:<\/b><\/p>\r\n<pre><code class=\"language-php\">\/\/error-null-9560\u3067\u3001\u30b9\u30e9\u30c3\u30b0\u3092\u51fa\u529b\r\nfunction shortcode_slug() {\r\n    global $post;\r\n    if ($post &amp;&amp; isset($post-&gt;post_name)) {\r\n        return $post-&gt;post_name;\r\n    }\r\n    return &#39;&#39;;\r\n}\r\nadd_shortcode(&#39;slug&#39;, &#39;shortcode_slug&#39;);\r\n\r\n\/\/WordPress\u3067\u3001\u6700\u521d\u306e\u30ab\u30c6\u30b4\u30ea\u30fc\u540d\u3092\u51fa\u529b\r\nfunction shortcode_cat_name() {\r\n    if (has_category()) {\r\n        $category = get_the_category();\r\n        if (!empty($category)) {\r\n            return $category[0]-&gt;cat_name;\r\n        }\r\n    }\r\n    return &#39;&#39;;\r\n}\r\nadd_shortcode(&#39;cat_name&#39;, &#39;shortcode_cat_name&#39;);\r\n<\/code><\/pre>\r\n\r\n<h3 class=\"fz-ml\">\u30b9\u30c6\u30c3\u30d75: \u52d5\u4f5c\u78ba\u8a8d<\/h3>\r\n<p>\u4ee5\u4e0b\u306e\u30da\u30fc\u30b8\u3067\u52d5\u4f5c\u78ba\u8a8d\u3092\u884c\u3044\u307e\u3059\uff1a<\/p>\r\n<ul style=\"list-style-type:bullet;\">\r\n  <li>\u2705 \u30d5\u30ed\u30f3\u30c8\u30da\u30fc\u30b8<\/li>\r\n  <li>\u2705 \u6295\u7a3f\u30da\u30fc\u30b8<\/li>\r\n  <li>\u2705 \u56fa\u5b9a\u30da\u30fc\u30b8<\/li>\r\n  <li>\u2705 \u30ab\u30c6\u30b4\u30ea\u30fc\u30a2\u30fc\u30ab\u30a4\u30d6<\/li>\r\n  <li>\u2705 \u30bf\u30b0\u30a2\u30fc\u30ab\u30a4\u30d6<\/li>\r\n  <li>\u2705 \u691c\u7d22\u7d50\u679c\u30da\u30fc\u30b8<\/li>\r\n  <li>\u2705 404\u30da\u30fc\u30b8<\/li>\r\n<\/ul>\r\n\r\n<h3 class=\"fz-ml\">\u30b9\u30c6\u30c3\u30d76: error_log\u3092\u518d\u78ba\u8a8d<\/h3>\r\n<pre><code class=\"language-bash\"># \u30a8\u30e9\u30fc\u30ed\u30b0\u3092\u30af\u30ea\u30a2\u3057\u3066\u76e3\u8996\r\n&gt; \/path\/to\/error_log\r\ntail -f \/path\/to\/error_log\r\n<\/code><\/pre>\r\n<p>\u5404\u30da\u30fc\u30b8\u3092\u5de1\u56de\u3057\u3066\u3001\u65b0\u3057\u3044\u30a8\u30e9\u30fc\u304c\u51fa\u306a\u3044\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\r\n<hr class=\"rule-hory mt-3r\">\r\n\r\n\r\n<h2 class=\"fz-xl\">7. \u307e\u3068\u3081<\/h2>\r\n\r\n<h3 class=\"fz-ml\">\u4fee\u6b63\u306e\u8981\u70b9<\/h3>\r\n<ol style=\"list-style-type:decimal;\">\r\n  <li>\r\n    <p><b class=\"fw-600\"><code>$post<\/code>\u306f\u5e38\u306b\u5b58\u5728\u78ba\u8a8d\u3059\u308b<\/b><\/p>\r\n    <pre><code class=\"language-php\">if ($post &amp;&amp; isset($post-&gt;ID)) { \/* \u51e6\u7406 *\/ }\r\n<\/code><\/pre>\r\n  <\/li>\r\n  <li>\r\n    <p><b class=\"fw-600\">\u914d\u5217\u3082\u7a7a\u30c1\u30a7\u30c3\u30af\u3059\u308b<\/b><\/p>\r\n    <pre><code class=\"language-php\">if (!empty($array)) { \/* \u51e6\u7406 *\/ }\r\n<\/code><\/pre>\r\n  <\/li>\r\n  <li>\r\n    <p><b class=\"fw-600\">\u95a2\u6570\u5185\u3067\u306f<code>global<\/code>\u5ba3\u8a00\u3092\u5fd8\u308c\u306a\u3044<\/b><\/p>\r\n    <pre><code class=\"language-php\">global $post;\r\n<\/code><\/pre>\r\n  <\/li>\r\n  <li>\r\n    <p><b class=\"fw-600\">\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u3067\u4e00\u5143\u7ba1\u7406\u3059\u308b<\/b><\/p>\r\n    <ul style=\"list-style-type:bullet;\">\r\n      <li>shortcodes.php\u306b\u8a2d\u5b9a\u95a2\u6570\u3092\u4f5c\u6210<\/li>\r\n      <li>\u5404\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306f<code>global<\/code>\u5ba3\u8a00\u3060\u3051\u3067\u4f7f\u7528\u53ef\u80fd<\/li>\r\n    <\/ul>\r\n  <\/li>\r\n<\/ol>\r\n\r\n<h3 class=\"fz-ml\">\u4fee\u6b63\u5f8c\u306e\u30e1\u30ea\u30c3\u30c8<\/h3>\r\n<ul style=\"list-style-type:bullet;\">\r\n  <li>\u2705 error_log\u304c\u30af\u30ea\u30fc\u30f3\u306b\u306a\u308b<\/li>\r\n  <li>\u2705 \u30b5\u30fc\u30d0\u30fc\u8ca0\u8377\u304c\u8efd\u6e1b\u3055\u308c\u308b<\/li>\r\n  <li>\u2705 \u30c7\u30d0\u30c3\u30b0\u304c\u5bb9\u6613\u306b\u306a\u308b<\/li>\r\n  <li>\u2705 \u30b3\u30fc\u30c9\u306e\u4fdd\u5b88\u6027\u304c\u5411\u4e0a\u3059\u308b<\/li>\r\n  <li>\u2705 WordPress\u6a19\u6e96\u306b\u6e96\u62e0\u3057\u305f\u30b3\u30fc\u30c9\u306b\u306a\u308b<\/li>\r\n<\/ul>\r\n\r\n<hr class=\"rule-hory mt-3r\">\r\n<a href=\"https:\/\/code-plus.jp\/gp\/body-idclass-8404\/\" class=\"linkbox my-1.5r\">\r\n<h4 class=\"linkbox-title fz-md\">\u3010WordPress\u3011body\u306eid\u306b\u30b9\u30e9\u30c3\u30b0\u540d\u3001body_class\u306b\u4efb\u610f\u306e\u30af\u30e9\u30b9\u3092\u8ffd\u52a0\u3059\u308b\u65b9\u6cd5<\/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\/da9500431216c82ae6549db7e1d5ecb1.jpg\" alt=\"\u3010WordPress\u3011body\u306eid\u306b\u30b9\u30e9\u30c3\u30b0\u540d\u3001body_class\u306b\u4efb\u610f\u306e\u30af\u30e9\u30b9\u3092\u8ffd\u52a0\u3059\u308b\u65b9\u6cd5\" loading=\"lazy\" \/>\r\n<\/picture>\r\n<span class=\"linkbox-excerpt\">WordPress\u3067&lt;body&gt;\u306bID\u3084\u30af\u30e9\u30b9\u3092\u8ffd\u52a0\u3059\u308b\u65b9\u6cd5\uff1a&lt;body id=&#39;&lt;?php echo($post-&gt;post_name); ?&gt;&#39;&gt; \u5b9f\u306f\u3053\u306e\u30b3\u30fc\u30c9\u3001\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3059\u3002\u4eca\u56de\u306f\u306a\u305c\u30a8\u30e9\u30fc\u304c\u8d77\u304d\u308b\u306e\u304b\u3001\u305d\u3057\u3066\u3069\u3046\u3059\u308c\u3070\u6b63\u3057\u304f\u5b9f\u88c5\u3067\u304d\u308b\u306e\u304b\u3092\u3001\u521d\u5fc3\u8005\u306e\u65b9\u306b\u3082\u308f\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3057\u307e\u3059\u3002\u3000\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=\"rule-hory mt-3r\">\r\n\r\n\r\n<h2 class=\"fz-xl\">\u53c2\u8003\u30ea\u30f3\u30af<\/h2>\r\n<ul style=\"list-style-type:bullet;\">\r\n  <li><cite><a href=\"https:\/\/codex.wordpress.org\/Global_Variables#Post_Variables\" class=\"link\" target=\"_blank\">WordPress Codex: $post<\/a><\/cite><\/li>\r\n  <li><cite><a href=\"https:\/\/developer.wordpress.org\/reference\/classes\/wp_post\/\" class=\"link\" target=\"_blank\">WordPress Developer Resources: WP_Post<\/a><\/cite><\/li>\r\n  <li><cite><a href=\"https:\/\/www.php.net\/manual\/ja\/migration70.new-features.php\" class=\"link\" target=\"_blank\">PHP: Null Coalescing Operator<\/a><\/cite><\/li>\r\n<\/ul>\r\n","protected":false},"excerpt":{"rendered":"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\u3067\u306e\u4e00\u5143\u7ba1\u7406\u307e\u3067\u3001$post->ID\u3084$post->post_name, $_GET['post'] \u3067\u306e\u30a8\u30e9\u30fc\u306e\u539f\u56e0\u3068\u5bfe\u7b56\u3092\u5b9f\u8df5\u7684\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002","protected":false},"author":1,"featured_media":9562,"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":[],"group":[],"pg":[],"class_list":["post-9560","post","type-post","status-publish","format-standard","has-post-thumbnail","category-wordpress"],"acf":[],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/9560","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=9560"}],"version-history":[{"count":0,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/9560\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media\/9562"}],"wp:attachment":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media?parent=9560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/categories?post=9560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/tags?post=9560"},{"taxonomy":"group","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/group?post=9560"},{"taxonomy":"pg","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/pg?post=9560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}