{"id":7123,"date":"2022-03-11T09:28:52","date_gmt":"2022-03-11T00:28:52","guid":{"rendered":"https:\/\/hanami-web.tokyo.jp\/blog\/?p=7123"},"modified":"2023-05-03T08:46:00","modified_gmt":"2023-05-02T23:46:00","slug":"php-customize","status":"publish","type":"post","link":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/","title":{"rendered":"Prerequisites before editing WordPress theme or plugin php files"},"content":{"rendered":"<p>If you need to customize a theme or plugin, here are some basic knowledge you should know before customizing the installed PHP.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<section class=\"wp-block-uagb-section uagb-section__wrap uagb-section__background-undefined uagb-block-596d56ab\"><div class=\"uagb-section__overlay\"><\/div><div class=\"uagb-section__inner-wrap\">\n<p>If you edit the php files incorrectly, there is a risk that your site may break, so please proceed at your own discretion.<br>To ensure peace of mind, it is a good idea to always create a backup before starting work so that you can restore it at any time.<\/p>\n<\/div><\/section>\n\n\n<div class=\"sc\"><a href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/how-to-setting-padimembershippro\/\" title=\"Paid Memberships Pro Explanation Table of Contents\">\r\n\t<p class=\"sc-txt01\">We also built a membership site using Paid Membership Pro.<\/p>\r\n\t<p class=\"sc-txt01\">I have created an explanatory article on how to set it up as a reminder, so please feel free to use it as a reference!<\/p>\r\n\t<p class=\"sc-txt02\">Paid Memberships Pro Explanation Table of Contents \u2192<\/p>\r\n<\/a><\/div>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">table of contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #000000;color:#000000\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #000000;color:#000000\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/#%e3%82%b3%e3%82%a2%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e7%9b%b4%e6%8e%a5%e7%b7%a8%e9%9b%86%e3%81%97%e3%81%aa%e3%81%84\" >Do not edit core files directly<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/#%e3%81%be%e3%81%9a%e3%81%af%e3%82%b3%e3%82%a2%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%81%a8%e3%81%af%ef%bc%9f%e3%81%a7%e3%81%99%e3%81%8c%e3%80%81\" >First of all, what is a core file?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/#%e3%81%aa%e3%81%9c%e3%80%81%e3%82%b3%e3%82%a2%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e7%9b%b4%e6%8e%a5%e7%b7%a8%e9%9b%86%e3%81%97%e3%81%a6%e3%81%af%e3%81%84%e3%81%91%e3%81%aa%e3%81%84%e3%81%ae%e3%81%8b%ef%bc%9f\" >Why shouldn&#039;t you edit core files directly?<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/#%e3%83%86%e3%83%bc%e3%83%9e%e3%82%b3%e3%82%a2%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e7%b7%a8%e9%9b%86%e3%81%97%e3%81%9f%e3%81%84%e5%a0%b4%e5%90%88\" >If you want to edit the theme core files<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/#%e3%83%97%e3%83%a9%e3%82%b0%e3%82%a4%e3%83%b3%e3%82%b3%e3%82%a2%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e7%b7%a8%e9%9b%86%e3%81%97%e3%81%9f%e3%81%84%e5%a0%b4%e5%90%88\" >If you want to edit the plugin core file<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/#%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%9e%e3%82%a4%e3%82%ba%e6%96%b9%e6%b3%95\" >How to Customize<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/#php%e3%81%ae%e5%9f%ba%e6%9c%ac\" >PHP Basics<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/#%e3%82%b3%e3%83%a1%e3%83%b3%e3%83%88%e3%82%92%e8%bf%bd%e5%8a%a0\" >Add Comment<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/#%e9%96%8b%e5%a7%8b%e3%82%bf%e3%82%b0\" >Start tag<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/#%e7%b5%82%e4%ba%86%e3%82%bf%e3%82%b0\" >End tag<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/#1%e3%81%a4%e3%81%ae%e3%82%b3%e3%83%bc%e3%83%89%e3%81%ab%ef%bc%91%e3%81%a4%e3%81%ae%e9%96%8b%e5%a7%8b%e3%82%bf%e3%82%b0%e3%81%a8%e7%b5%82%e4%ba%86%e3%82%bf%e3%82%b0\" >One start and end tag per code<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/#%e3%83%80%e3%83%a1%e3%81%aa%e4%be%8b%e2%91%a0\" >Bad example \u2460<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/#%e8%89%af%e3%81%84%e4%be%8b%e2%91%a0\" >Good example 1<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/#%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85\" >Notes<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/#%e3%82%a8%e3%83%a9%e3%83%bc%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6\" >About errors<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/#php_fatal_error_cannot_redeclare_function%e3%80%82\" >PHP Fatal Error: Cannot redeclare function.<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/#%e3%82%b5%e3%82%a4%e3%83%88%e3%81%ae%e3%82%a8%e3%83%a9%e3%83%bc%e5%af%be%e7%ad%96\" >Troubleshooting site errors<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/#%e3%83%90%e3%83%83%e3%82%af%e3%82%a2%e3%83%83%e3%83%97\" >backup<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/#%e3%83%87%e3%83%90%e3%83%83%e3%82%af%e3%83%a2%e3%83%bc%e3%83%89%e3%82%92on%e3%81%ab%e3%81%97%e3%81%a6%e3%82%a8%e3%83%a9%e3%83%bc%e3%82%92%e8%a6%8b%e3%81%88%e3%82%8b%e5%bd%a2%e3%81%ab%e3%81%99%e3%82%8b\" >Turn on debug mode to make errors visible<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/hanami-web.tokyo.jp\/blog\/en\/member\/php-customize\/#%e3%83%97%e3%83%a9%e3%82%b0%e3%82%a4%e3%83%b3%e3%82%92%e5%81%9c%e6%ad%a2\" >Stop the plugin<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%e3%82%b3%e3%82%a2%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e7%9b%b4%e6%8e%a5%e7%b7%a8%e9%9b%86%e3%81%97%e3%81%aa%e3%81%84\"><\/span>Do not edit core files directly<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%e3%81%be%e3%81%9a%e3%81%af%e3%82%b3%e3%82%a2%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%81%a8%e3%81%af%ef%bc%9f%e3%81%a7%e3%81%99%e3%81%8c%e3%80%81\"><\/span>First of all, what is a core file?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Theme files<\/li><li>Plugin files<\/li><\/ul>\n\n\n\n<p>Core files are files added when installing wordrpess, such as the above. Files that are distributed by the author and have not been touched by anyone are core files. These are files that are overwritten by updates from the author.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%e3%81%aa%e3%81%9c%e3%80%81%e3%82%b3%e3%82%a2%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e7%9b%b4%e6%8e%a5%e7%b7%a8%e9%9b%86%e3%81%97%e3%81%a6%e3%81%af%e3%81%84%e3%81%91%e3%81%aa%e3%81%84%e3%81%ae%e3%81%8b%ef%bc%9f\"><\/span>Why shouldn&#039;t you edit core files directly?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>If you make a mistake in even one place, it won&#039;t work.<\/li><li>The update will overwrite the modified file and the file will be restored.<\/li><\/ul>\n\n\n\n<p>So, do not edit the core files directly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%e3%83%86%e3%83%bc%e3%83%9e%e3%82%b3%e3%82%a2%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e7%b7%a8%e9%9b%86%e3%81%97%e3%81%9f%e3%81%84%e5%a0%b4%e5%90%88\"><\/span>If you want to edit the theme core files<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>There may be times when you want to customize a theme.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>I want to embed ad tags and analysis tags in the header<\/li><li>Edited the header\/footer design<\/li><li>I want to customize the top page.<\/li><\/ul>\n\n\n\n<p>If you customize a theme, you can create a child theme and edit it there.<\/p>\n\n\n\n<section class=\"wp-block-uagb-section uagb-section__wrap uagb-section__background-undefined uagb-block-306f3ba3\"><div class=\"uagb-section__overlay\"><\/div><div class=\"uagb-section__inner-wrap\">\n<p>Nowadays, theme companies often distribute child themes for free, so it is convenient to use a distributed child theme as you do not have to create your own child theme from scratch.<br>&amp;quot;xxx theme child theme&amp;quot;&lt;br&gt;I&amp;#039;m sure if you search for something like that you&amp;#039;ll find it.<\/p>\n<\/div><\/section>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%e3%83%97%e3%83%a9%e3%82%b0%e3%82%a4%e3%83%b3%e3%82%b3%e3%82%a2%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e7%b7%a8%e9%9b%86%e3%81%97%e3%81%9f%e3%81%84%e5%a0%b4%e5%90%88\"><\/span>If you want to edit the plugin core file<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Use the code snippet plugin.<\/p>\n\n\n\n<p><a href=\"https:\/\/wordpress.org\/plugins\/code-snippets\/\">https:\/\/wordpress.org\/plugins\/code-snippets\/<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"514\" src=\"https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/image-1024x514.png\" alt=\"\" class=\"wp-image-7124\" srcset=\"https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/image-1024x514.png 1024w, https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/image-300x151.png 300w, https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/image-768x386.png 768w, https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/image.png 1207w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%9e%e3%82%a4%e3%82%ba%e6%96%b9%e6%b3%95\"><\/span>How to Customize<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Click Add New to add a new code. Simply enter the code you want to add in the Code field. You can freely enter the Title and other fields.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"575\" src=\"https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/image-24-1024x575.png\" alt=\"\" class=\"wp-image-7199\" srcset=\"https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/image-24-1024x575.png 1024w, https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/image-24-300x169.png 300w, https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/image-24-768x431.png 768w, https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/image-24-120x68.png 120w, https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/image-24-160x90.png 160w, https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/image-24-320x180.png 320w, https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/image-24.png 1157w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"php%e3%81%ae%e5%9f%ba%e6%9c%ac\"><\/span>PHP Basics<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%e3%82%b3%e3%83%a1%e3%83%b3%e3%83%88%e3%82%92%e8%bf%bd%e5%8a%a0\"><\/span>Add Comment<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Comments are useful clues for other people to use when making corrections, so it is a good idea to leave the comments intact even when adding code by copying and pasting. Add \/\/ before the start of the comment.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/Add your comment here<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%e9%96%8b%e5%a7%8b%e3%82%bf%e3%82%b0\"><\/span>Start tag<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The php code is<\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php<\/code><\/pre>\n\n\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%e7%b5%82%e4%ba%86%e3%82%bf%e3%82%b0\"><\/span>End tag<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>It ends with ?&gt;. Add your PHP code between the opening and closing tags.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>?&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1%e3%81%a4%e3%81%ae%e3%82%b3%e3%83%bc%e3%83%89%e3%81%ab%ef%bc%91%e3%81%a4%e3%81%ae%e9%96%8b%e5%a7%8b%e3%82%bf%e3%82%b0%e3%81%a8%e7%b5%82%e4%ba%86%e3%82%bf%e3%82%b0\"><\/span>One start and end tag per code<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Do not add more than one code between one opening and one closing tag.<\/p>\n\n\n\n<p>To safely customize:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><\/code><\/pre>\n\n\n\n<p>In this way, it is better to enclose each one in start and end tags and divide them.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%e3%83%80%e3%83%a1%e3%81%aa%e4%be%8b%e2%91%a0\"><\/span>Bad example \u2460<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Put php inside php<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\u65e2\u5b58\u306e\u30b3\u30fc\u30c9\n....\n\u3000\u3000?&gt;\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%e8%89%af%e3%81%84%e4%be%8b%e2%91%a0\"><\/span>Good example 1<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code><\/code><\/pre>\n\n\n\n<p>You can also connect<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\u65e2\u5b58\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u30b3\u30fc\u30c9\n...\n\u8ffd\u52a0\u3059\u308b\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u30b3\u30fc\u30c9\n...\n?&gt;\n\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85\"><\/span>Notes<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>WordPress has a rule that omits the final php closing tag. If you want to add new code to existing code, you need to add the closing tag to the existing code before adding the new custom code.<\/p>\n\n\n\n<p>As shown in the screenshot below, the closing tag that should be on the last line, line 37, has been omitted.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"183\" src=\"https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/image-4-1024x183.png\" alt=\"\" class=\"wp-image-7137\" srcset=\"https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/image-4-1024x183.png 1024w, https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/image-4-300x54.png 300w, https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/image-4-768x138.png 768w, https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/image-4.png 1038w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%e3%82%a8%e3%83%a9%e3%83%bc%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6\"><\/span>About errors<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>We will explain some common errors.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"php_fatal_error_cannot_redeclare_function%e3%80%82\"><\/span><code>PHP Fatal Error: Cannot redeclare function<\/code>.<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>This error occurs when the same function is used. Try changing the function name to resolve the error.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%e3%82%b5%e3%82%a4%e3%83%88%e3%81%ae%e3%82%a8%e3%83%a9%e3%83%bc%e5%af%be%e7%ad%96\"><\/span>Troubleshooting site errors<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Errors can occur, so it is important to take precautions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%e3%83%90%e3%83%83%e3%82%af%e3%82%a2%e3%83%83%e3%83%97\"><\/span>backup<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>You can easily perform backups using the upDraftPlus plugin.<\/p>\n\n\n\n<p>You can work with peace of mind by testing the restoration from a backup in advance.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Must-see for WordPress users! The easiest backup plugin for restoration is [Updraft Plus]!!\" width=\"1290\" height=\"726\" src=\"https:\/\/www.youtube.com\/embed\/yQLuWEiHka0?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%e3%83%87%e3%83%90%e3%83%83%e3%82%af%e3%83%a2%e3%83%bc%e3%83%89%e3%82%92on%e3%81%ab%e3%81%97%e3%81%a6%e3%82%a8%e3%83%a9%e3%83%bc%e3%82%92%e8%a6%8b%e3%81%88%e3%82%8b%e5%bd%a2%e3%81%ab%e3%81%99%e3%82%8b\"><\/span>Turn on debug mode to make errors visible<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>You can find out where the error is by turning on debug mode.<\/p>\n\n\n\n<p>\u25bcHow to enable WordPress debug mode (reference site)\u25bc<\/p>\n\n\n\n<p><a href=\"https:\/\/wp.go-sign.info\/how-to-enable-wordpress-debug-mode\/\">https:\/\/wp.go-sign.info\/how-to-enable-wordpress-debug-mode\/<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%e3%83%97%e3%83%a9%e3%82%b0%e3%82%a4%e3%83%b3%e3%82%92%e5%81%9c%e6%ad%a2\"><\/span>Stop the plugin<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>In some cases, the site can be restored by disabling the plugin that is causing the error. When a site breaks due to customization, you may be able to temporarily restore the site to a viewable state by disabling the plugin that is causing the error.<\/p>","protected":false},"excerpt":{"rendered":"<p>\u30c6\u30fc\u30de\u3084\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305fphp\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308b\u524d\u306b\u3001\u77e5\u3063\u3066\u304a\u3044\u305f\u65b9\u304c\u826f\u3044\u524d\u63d0\u77e5\u8b58\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002 \u30b3\u30a2\u30d5\u30a1\u30a4\u30eb\u3092\u76f4\u63a5\u7de8\u96c6\u3057\u306a\u3044 \u307e\u305a\u306f\u30b3\u30a2\u30d5\u30a1\u30a4\u30eb\u3068\u306f\uff1f\u3067\u3059\u304c\u3001 \u30c6\u30fc\u30de\u30d5\u30a1\u30a4\u30eb  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":9196,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"content-type":"","_uag_custom_page_level_css":"","footnotes":""},"categories":[1442],"tags":[1497],"class_list":["post-7123","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-member","tag-paid-membership-pro"],"blocksy_meta":[],"aioseo_notices":[],"uagb_featured_image_src":{"full":["https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/thumnail-22.png",720,540,false],"thumbnail":["https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/thumnail-22-150x150.png",150,150,true],"medium":["https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/thumnail-22-300x225.png",300,225,true],"medium_large":["https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/thumnail-22.png",720,540,false],"large":["https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/thumnail-22.png",720,540,false],"1536x1536":["https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/thumnail-22.png",720,540,false],"2048x2048":["https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/thumnail-22.png",720,540,false],"trp-custom-language-flag":["https:\/\/hanami-web.tokyo.jp\/blog\/wp-content\/uploads\/2022\/03\/thumnail-22.png",16,12,false]},"uagb_author_info":{"display_name":"\u682a\u5f0f\u4f1a\u793eHanamiWEB \u4ee3\u8868\u53d6\u7de0\u5f79 \u677e\u6d66\u307f\u3055","author_link":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/author\/hanami\/"},"uagb_comment_info":0,"uagb_excerpt":"\u30c6\u30fc\u30de\u3084\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305fphp\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308b\u524d\u306b\u3001\u77e5\u3063\u3066\u304a\u3044\u305f\u65b9\u304c&hellip;","brizy_media":[],"_links":{"self":[{"href":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/wp-json\/wp\/v2\/posts\/7123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/wp-json\/wp\/v2\/comments?post=7123"}],"version-history":[{"count":0,"href":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/wp-json\/wp\/v2\/posts\/7123\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/wp-json\/wp\/v2\/media\/9196"}],"wp:attachment":[{"href":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/wp-json\/wp\/v2\/media?parent=7123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/wp-json\/wp\/v2\/categories?post=7123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hanami-web.tokyo.jp\/blog\/en\/wp-json\/wp\/v2\/tags?post=7123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}