{"id":1132,"date":"2019-09-07T03:55:47","date_gmt":"2019-09-06T19:55:47","guid":{"rendered":"http:\/\/jrblog.pentaidea.com\/john\/2019\/09\/07\/wordpress-faq\/"},"modified":"2019-09-07T03:55:47","modified_gmt":"2019-09-06T19:55:47","slug":"wordpress-faq","status":"publish","type":"post","link":"https:\/\/john.pentaidea.com\/?p=1132","title":{"rendered":"WordPress FAQ"},"content":{"rendered":"<p><span style=\"font-weight: bold; color: rgb(250, 122, 0); font-size: 14pt; text-decoration: underline;\">GENERAL<\/span><\/p>\n<ul>\n<li>\n<p>ServerName not found&nbsp;<\/p>\n<\/li>\n<ul>\n<li>\n<p>Msg:<\/p>\n<\/li>\n<ul>\n<li>\n<p>FQDN not found<\/p>\n<\/li>\n<li>\n<p>mysqli connection exception, server name not found<\/p>\n<\/li>\n<\/ul>\n<li>\n<p>Ans:<\/p>\n<\/li>\n<ul>\n<li>\n<p>Rebuild wordpress after <b>cleaning all old data on disk<\/b>.&nbsp;<\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<li>\n<p>Write parameter debug log&nbsp;<\/p>\n<\/li>\n<\/ul>\n<pre><code>$sudo vi .\/your_wp_html\/wp-includes\/functions.php\n\n---&nbsp;&nbsp;functions.php ---\n...\n\/**\n* Simple helper to debug to the console\n*\n* @param $data object, array, string $data\n* @param $context string&nbsp;&nbsp;Optional a description.\n*\n* @return string\n*\/\nfunction debug_to_console($data, $context = &apos;Debug in Console&apos;) {\n&nbsp;&nbsp;&nbsp;&nbsp;\/\/ Buffering to solve problems frameworks, like header() in this and not a solid return.\n&nbsp;&nbsp;&nbsp;&nbsp;ob_start();\n\n&nbsp;&nbsp;&nbsp;&nbsp;$output&nbsp;&nbsp;= &apos;console.info(\\&apos;&apos; . $context . &apos;:\\&apos;);&apos;;\n&nbsp;&nbsp;&nbsp;&nbsp;$output .= &apos;console.log(&apos; . json_encode($data) . &apos;);&apos;;\n&nbsp;&nbsp;&nbsp;&nbsp;$output&nbsp;&nbsp;= sprintf(&apos;&lt;script&gt;%s&lt;\/script&gt;&apos;, $output);\n\n&nbsp;&nbsp;&nbsp;&nbsp;echo $output;\n}\n...\n------\n\n\n# Now Usage in any .php file\n\n\ndebug_to_console($xxx)\n\n\n<\/code><\/pre>\n<p>Result:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2020\/05\/b79685d02b86436d5648f97c3a90537d.png\"\/><\/p>\n<p><span style=\"font-weight: bold; color: rgb(250, 122, 0); font-size: 14pt; text-decoration: underline;\">POSTS<\/span><\/p>\n<ul>\n<li>\n<p>Order posts by last modified\/update date<\/p>\n<\/li>\n<\/ul>\n<pre><code>$sudo vi {your_wp_html}\/wp-content\/themes\/{your_current_theme}\/functions.php\n\n---&nbsp; functions.php&nbsp;---\n...\n# Remove `$query-&gt;is_main_query()` check if needs&nbsp;\nfunction lmt_orderby_modified_posts( $query ) {\n&nbsp;&nbsp;&nbsp;&nbsp;if( $query-&gt;is_main_query() &amp;&amp; !is_admin() ) {\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( $query-&gt;is_home() || $query-&gt;is_category() || $query-&gt;is_tag() ) {\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$query-&gt;set( &apos;orderby&apos;, &apos;modified&apos; );\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$query-&gt;set( &apos;order&apos;, &apos;desc&apos; );\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;}\n}\nadd_action( &apos;pre_get_posts&apos;, &apos;lmt_orderby_modified_posts&apos; );\n...\n------\n<\/code><\/pre><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>GENERAL<\/p>\n<\/div>","protected":false},"author":1,"featured_media":1267,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1132","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>WordPress FAQ - John&#039;s Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/john.pentaidea.com\/?p=1132\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WordPress FAQ - John&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"GENERAL\" \/>\n<meta property=\"og:url\" content=\"https:\/\/john.pentaidea.com\/?p=1132\" \/>\n<meta property=\"og:site_name\" content=\"John&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-09-06T19:55:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2020\/05\/b79685d02b86436d5648f97c3a90537d.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2105\" \/>\n\t<meta property=\"og:image:height\" content=\"234\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"jj\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"jj\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/john.pentaidea.com\/?p=1132\",\"url\":\"https:\/\/john.pentaidea.com\/?p=1132\",\"name\":\"WordPress FAQ - John&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\/\/john.pentaidea.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/john.pentaidea.com\/?p=1132#primaryimage\"},\"image\":{\"@id\":\"https:\/\/john.pentaidea.com\/?p=1132#primaryimage\"},\"thumbnailUrl\":\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2020\/05\/b79685d02b86436d5648f97c3a90537d.png\",\"datePublished\":\"2019-09-06T19:55:47+00:00\",\"dateModified\":\"2019-09-06T19:55:47+00:00\",\"author\":{\"@id\":\"https:\/\/john.pentaidea.com\/#\/schema\/person\/3d2e5980a7d3023e93b91d668d2a4a4f\"},\"breadcrumb\":{\"@id\":\"https:\/\/john.pentaidea.com\/?p=1132#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/john.pentaidea.com\/?p=1132\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/john.pentaidea.com\/?p=1132#primaryimage\",\"url\":\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2020\/05\/b79685d02b86436d5648f97c3a90537d.png\",\"contentUrl\":\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2020\/05\/b79685d02b86436d5648f97c3a90537d.png\",\"width\":2105,\"height\":234},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/john.pentaidea.com\/?p=1132#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/john.pentaidea.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WordPress FAQ\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/john.pentaidea.com\/#website\",\"url\":\"https:\/\/john.pentaidea.com\/\",\"name\":\"John's Blog\",\"description\":\"\u4e16\u754c\u56e0\u601d\u7dd2\u800c\u8907\u96dc, \u4eba\u56e0\u5922\u60f3\u800c\u5049\u5927\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/john.pentaidea.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/john.pentaidea.com\/#\/schema\/person\/3d2e5980a7d3023e93b91d668d2a4a4f\",\"name\":\"jj\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/john.pentaidea.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a685414cd92056415bc823b5cfbbf95a44a98df88d8c040b18613724c1c0724b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a685414cd92056415bc823b5cfbbf95a44a98df88d8c040b18613724c1c0724b?s=96&d=mm&r=g\",\"caption\":\"jj\"},\"sameAs\":[\"https:\/\/john.pentaidea.com\"],\"url\":\"https:\/\/john.pentaidea.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"WordPress FAQ - John&#039;s Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/john.pentaidea.com\/?p=1132","og_locale":"en_US","og_type":"article","og_title":"WordPress FAQ - John&#039;s Blog","og_description":"GENERAL","og_url":"https:\/\/john.pentaidea.com\/?p=1132","og_site_name":"John&#039;s Blog","article_published_time":"2019-09-06T19:55:47+00:00","og_image":[{"width":2105,"height":234,"url":"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2020\/05\/b79685d02b86436d5648f97c3a90537d.png","type":"image\/png"}],"author":"jj","twitter_card":"summary_large_image","twitter_misc":{"Written by":"jj","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/john.pentaidea.com\/?p=1132","url":"https:\/\/john.pentaidea.com\/?p=1132","name":"WordPress FAQ - John&#039;s Blog","isPartOf":{"@id":"https:\/\/john.pentaidea.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/john.pentaidea.com\/?p=1132#primaryimage"},"image":{"@id":"https:\/\/john.pentaidea.com\/?p=1132#primaryimage"},"thumbnailUrl":"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2020\/05\/b79685d02b86436d5648f97c3a90537d.png","datePublished":"2019-09-06T19:55:47+00:00","dateModified":"2019-09-06T19:55:47+00:00","author":{"@id":"https:\/\/john.pentaidea.com\/#\/schema\/person\/3d2e5980a7d3023e93b91d668d2a4a4f"},"breadcrumb":{"@id":"https:\/\/john.pentaidea.com\/?p=1132#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/john.pentaidea.com\/?p=1132"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/john.pentaidea.com\/?p=1132#primaryimage","url":"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2020\/05\/b79685d02b86436d5648f97c3a90537d.png","contentUrl":"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2020\/05\/b79685d02b86436d5648f97c3a90537d.png","width":2105,"height":234},{"@type":"BreadcrumbList","@id":"https:\/\/john.pentaidea.com\/?p=1132#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/john.pentaidea.com\/"},{"@type":"ListItem","position":2,"name":"WordPress FAQ"}]},{"@type":"WebSite","@id":"https:\/\/john.pentaidea.com\/#website","url":"https:\/\/john.pentaidea.com\/","name":"John's Blog","description":"\u4e16\u754c\u56e0\u601d\u7dd2\u800c\u8907\u96dc, \u4eba\u56e0\u5922\u60f3\u800c\u5049\u5927","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/john.pentaidea.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/john.pentaidea.com\/#\/schema\/person\/3d2e5980a7d3023e93b91d668d2a4a4f","name":"jj","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/john.pentaidea.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a685414cd92056415bc823b5cfbbf95a44a98df88d8c040b18613724c1c0724b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a685414cd92056415bc823b5cfbbf95a44a98df88d8c040b18613724c1c0724b?s=96&d=mm&r=g","caption":"jj"},"sameAs":["https:\/\/john.pentaidea.com"],"url":"https:\/\/john.pentaidea.com\/?author=1"}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2020\/05\/b79685d02b86436d5648f97c3a90537d.png","_links":{"self":[{"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/posts\/1132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1132"}],"version-history":[{"count":0,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/posts\/1132\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/media\/1267"}],"wp:attachment":[{"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}