{"id":102839,"date":"2020-04-27T02:18:15","date_gmt":"2020-04-26T19:18:15","guid":{"rendered":"https:\/\/harianaceh.co.id\/?p=102839"},"modified":"2022-10-06T04:22:32","modified_gmt":"2022-10-05T21:22:32","slug":"tips-how-to-fix-the-wordpress-loopback-error-with-2-steps","status":"publish","type":"post","link":"https:\/\/www.harianaceh.co.id\/2020\/04\/27\/tips-how-to-fix-the-wordpress-loopback-error-with-2-steps\/","title":{"rendered":"Tips How to Fix the WordPress Loopback Error With 2 Steps"},"content":{"rendered":"<p><strong>BANDA ACEH<\/strong> &#8211;\u00a0<a class=\"rank-math-link\" href=\"https:\/\/www.wordpress.com\/\" target=\"_blank\" rel=\"noopener\">WordPress<\/a>\u00a0is a very powerful website content management system that is used by millions. Sometimes the application will show errors that will make you scratch your head, such as the common WordPress <a title=\"loopback error\" href=\"https:\/\/www.harianaceh.co.id\/tag\/loopback-error\/\">loopback error<\/a> that you may see when it runs a site health check.<\/p>\n<h3><span id=\"How_do_I_Know_if_I_Have_This_Error\" class=\"ez-toc-section\"><\/span>How do I Know if I Have This Error?<\/h3>\n<p>The error usually pops up on the first page when you logon to the administrative dashboard of your WordPress site.<\/p>\n<p>However, you can also check for this error within the administrative dashboard of your WordPress installation.<\/p>\n<p>Once you are logged into the dashboard, hover over the Tools menu. When the menu appears, click on Site Health.<\/p>\n<p>If you have the error you will see a message that states \u201c<strong>Your site could not complete a loopback request<\/strong>\u201d similar to the one in the screenshot below.<\/p>\n<figure id=\"attachment_102840\" aria-describedby=\"caption-attachment-102840\" style=\"width: 687px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.harianaceh.co.id\/media\/2022\/09\/wordpress-loopback-error.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-102840\" src=\"https:\/\/www.harianaceh.co.id\/media\/2022\/09\/wordpress-loopback-error.png\" alt=\"WordPress Loopbak Error\" width=\"687\" height=\"183\" \/><\/a><figcaption id=\"caption-attachment-102840\" class=\"wp-caption-text\">WordPress Loopbak Error<\/figcaption><\/figure>\n<h3>What is a Loopback request?<\/h3>\n<p>A loopback request is simply a request that WordPress is trying to make to\u00a0<em>itself<\/em>.<\/p>\n<p>Loopback requests are used to run scheduled events (<em>wp-cron.php<\/em>).<\/p>\n<p>Loopback requests need to function correctly in order to ensure your website remains stable.<\/p>\n<h3><span id=\"What_caused_the_Error\" class=\"ez-toc-section\"><\/span>What caused the Error?<\/h3>\n<p>We were running WordPress in a Docker container. So when WordPress tried to loopback to itself via a domain name, the request didn\u2019t make it back to the Docker container.<\/p>\n<p>This was because the domain name wasn\u2019t listed in the <em><code>\/etc\/hosts<\/code><\/em>\u00a0file.<\/p>\n<h3><span id=\"Solution\" class=\"ez-toc-section\"><\/span>Solution<\/h3>\n<p>Login to your website using SSH with your favorite terminal application such as\u00a0<a class=\"rank-math-link\" href=\"https:\/\/www.putty.org\/\" target=\"_blank\" rel=\"noopener\">PuTTY<\/a>.<\/p>\n<p>Once you are logged in you will want to\u00a0<em><code>nano \/etc\/hosts<\/code><\/em>\u00a0to open up your servers host file. It should look similar to the screenshot below.<\/p>\n<figure id=\"attachment_102841\" aria-describedby=\"caption-attachment-102841\" style=\"width: 1024px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.harianaceh.co.id\/media\/2022\/09\/hostsfile-ssh.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-102841\" src=\"https:\/\/www.harianaceh.co.id\/media\/2022\/09\/hostsfile-ssh.png\" alt=\"hostsfile ssh\" width=\"1024\" height=\"168\" srcset=\"https:\/\/www.harianaceh.co.id\/media\/2022\/09\/hostsfile-ssh.png 1024w, https:\/\/www.harianaceh.co.id\/media\/2022\/09\/hostsfile-ssh-768x126.png 768w, https:\/\/www.harianaceh.co.id\/media\/2022\/09\/hostsfile-ssh-750x123.png 750w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption id=\"caption-attachment-102841\" class=\"wp-caption-text\">hostfile ssh<\/figcaption><\/figure>\n<p>Add the following line to the bottom of your hosts file. Make sure to change\u00a0<code>yourdomain.com<\/code> to your website domain.<\/p>\n<pre><span class=\"cm-number\">127.0.0.1 yourdomain.com<\/span><\/pre>\n<p>Once you add that line, you can type\u00a0<code>ctrl+x<\/code>. You will then be asked if you want to save your file, type\u00a0<code>y<\/code>\u00a0for yes.<\/p>\n<p>You are not required to reboot your system.<\/p>\n<h3>What about WordPress Docker Containers?<\/h3>\n<p>Docker is how I was exposed to WordPress loopback error in the first place.<\/p>\n<p>When using WordPress in a Docker Container, the loopback error becomes more of a Docker problem rather than a WordPress problem.<\/p>\n<p>However, if you are running WordPress via a\u00a0<em><code>docker run<\/code><\/em>\u00a0command (rather than using Docker Compose), then you wont be able to make permanent changes to the container.<\/p>\n<p>Luckily, Docker has an easy solution to this problem. The\u00a0<em><code>--add-host<\/code><\/em>\u00a0flag. When added to a\u00a0<em><code>docker run<\/code><\/em>\u00a0command this flag will allow Docker to add an entry in the\u00a0<em><code>\/etc\/hosts<\/code><\/em>\u00a0file within the container that you are trying to run.<\/p>\n<p>Simply add this flag to your\u00a0<em><code>docker run<\/code><\/em>\u00a0command. The flag is used like this\u00a0<em><code>--add-host yourdomain.com:127.0.0.1<\/code><\/em>.\u00a0<em><code>127.0.0.1<\/code><\/em>\u00a0being the host that you want to forward\u00a0<em><code>yourdomain.com<\/code><\/em>\u00a0to, in this case.<\/p>\n<p>Below is an example of a\u00a0<em><code>docker run<\/code><\/em>\u00a0command for WordPress that contains the\u00a0<em><code>--add-host<\/code><\/em>\u00a0flag.<\/p>\n<p>[php]<br \/>\ndocker run -d<br \/>\n&#8211;name wordpress<br \/>\n-p 8080:80<br \/>\n&#8211;add-host yourdomain.com:127.0.0.1<br \/>\nwordpress<br \/>\n[\/php]<\/p>\n<h3>Success<\/h3>\n<p>Now that you have changed your <code>\/etc\/hosts<\/code>\u00a0file, you can go back into the administrative backed of your WordPress installation to check your site health. If you are successful, then you will be presented with the following message \u201c<strong>Your site can perform loopback requests<\/strong>\u201c.<\/p>\n<p>It should look similar to the screenshot below.<\/p>\n<figure id=\"attachment_102842\" aria-describedby=\"caption-attachment-102842\" style=\"width: 811px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.harianaceh.co.id\/media\/2022\/09\/wordpress-loopback-success.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-102842\" src=\"https:\/\/www.harianaceh.co.id\/media\/2022\/09\/wordpress-loopback-success.png\" alt=\"wordpress loopback success\" width=\"811\" height=\"156\" srcset=\"https:\/\/www.harianaceh.co.id\/media\/2022\/09\/wordpress-loopback-success.png 811w, https:\/\/www.harianaceh.co.id\/media\/2022\/09\/wordpress-loopback-success-768x148.png 768w, https:\/\/www.harianaceh.co.id\/media\/2022\/09\/wordpress-loopback-success-750x144.png 750w\" sizes=\"auto, (max-width: 811px) 100vw, 811px\" \/><\/a><figcaption id=\"caption-attachment-102842\" class=\"wp-caption-text\">wordpress loopback success<\/figcaption><\/figure>\n<p>That it! If all goes well, the wordpress loopback error will disappear and you can get back to managing your site content.<\/p>\n<p>We hope with this post helped you to solve the WordPress loopback error. If you have any questions or comments about this post, feel free to leave a comment below.[]<\/p>\n<div class=\"pdfprnt-buttons pdfprnt-buttons-post pdfprnt-bottom-right\"><a href=\"https:\/\/www.harianaceh.co.id\/aplikasi-api\/wp\/v2\/posts\/102839?print=print\" class=\"pdfprnt-button pdfprnt-button-print\" target=\"_blank\" ><img decoding=\"async\" src=\"https:\/\/www.harianaceh.co.id\/apps\/pdf-print\/images\/print.png\" alt=\"image_print\" title=\"Print Content\" \/><\/a><\/div>","protected":false},"excerpt":{"rendered":"<p>WordPress\u00a0is a very powerful website content management system that is used by millions. Sometimes the application will show errors that will make you scratch your head, such as the common WordPress loopback error that you may see when it runs a site health check.<\/p>\n","protected":false},"author":1,"featured_media":102843,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","_seopress_robots_follow":"","_seopress_robots_imageindex":"","_seopress_robots_snippet":"","_seopress_robots_primary_cat":"","_seopress_robots_breadcrumbs":"","_seopress_robots_freeze_modified_date":"","_seopress_robots_custom_modified_date":"","_seopress_robots_canonical":"","_seopress_social_fb_title":"","_seopress_social_fb_desc":"","_seopress_social_fb_img":"","_seopress_social_fb_img_attachment_id":0,"_seopress_social_fb_img_width":0,"_seopress_social_fb_img_height":0,"_seopress_social_twitter_title":"","_seopress_social_twitter_desc":"","_seopress_social_twitter_img":"","_seopress_social_twitter_img_attachment_id":0,"_seopress_social_twitter_img_width":0,"_seopress_social_twitter_img_height":0,"_seopress_redirections_value":"","_seopress_redirections_enabled":"","_seopress_redirections_enabled_regex":"","_seopress_redirections_logged_status":"","_seopress_redirections_param":"","_seopress_redirections_type":0,"_seopress_analysis_target_kw":"","_seopress_news_disabled":"","_seopress_video_disabled":"","_seopress_video":[],"_seopress_pro_schemas_manual":[],"_seopress_pro_rich_snippets_disable_all":"","_seopress_pro_rich_snippets_disable":[],"_seopress_pro_schemas":[],"footnotes":"","_disable_autopaging":false},"categories":[98452,61],"tags":[42335,71190,90799,90800,90801],"series":[],"class_list":["post-102839","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorial","category-teknologi","tag-cloudflare","tag-how-to","tag-wordpress","tag-wordpress-loopback-error","tag-loopback-error"],"_links":{"self":[{"href":"https:\/\/www.harianaceh.co.id\/aplikasi-api\/wp\/v2\/posts\/102839","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.harianaceh.co.id\/aplikasi-api\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.harianaceh.co.id\/aplikasi-api\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.harianaceh.co.id\/aplikasi-api\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.harianaceh.co.id\/aplikasi-api\/wp\/v2\/comments?post=102839"}],"version-history":[{"count":0,"href":"https:\/\/www.harianaceh.co.id\/aplikasi-api\/wp\/v2\/posts\/102839\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.harianaceh.co.id\/aplikasi-api\/wp\/v2\/media\/102843"}],"wp:attachment":[{"href":"https:\/\/www.harianaceh.co.id\/aplikasi-api\/wp\/v2\/media?parent=102839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.harianaceh.co.id\/aplikasi-api\/wp\/v2\/categories?post=102839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.harianaceh.co.id\/aplikasi-api\/wp\/v2\/tags?post=102839"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/www.harianaceh.co.id\/aplikasi-api\/wp\/v2\/series?post=102839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}