{"id":3831,"date":"2024-10-31T13:03:00","date_gmt":"2024-10-31T13:03:00","guid":{"rendered":"https:\/\/john.pentaidea.com\/?p=3831"},"modified":"2024-10-31T13:03:00","modified_gmt":"2024-10-31T13:03:00","slug":"wordpress-faq-2","status":"publish","type":"post","link":"https:\/\/john.pentaidea.com\/?p=3831","title":{"rendered":"WordPress FAQ"},"content":{"rendered":"<p><b><span style=\"font-size: 14pt;\"><span style=\"color:rgb(250, 122, 0);\"><u>GENERAL<\/u><\/span><\/span><\/b><\/p>\n<ul>\n<li>\n<p>Upload file size limit of wordpress<\/p>\n<\/li>\n<ul>\n<li>\n<p>apt update<\/p>\n<\/li>\n<li>\n<p>apt install -y vim<\/p>\n<\/li>\n<li>\n<p>vi .htaccess<\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<pre><code>php_value upload_max_filesize 200M\nphp_value post_max_size 200M\nphp_value max_execution_time 300\nphp_value max_input_time 300\n<\/code><\/pre>\n<ul>\n<li>\n<p>MySQL can&#8217;t initialize DB, dir not empty<\/p>\n<\/li>\n<ul>\n<li>\n<p>Add to mysql deployment-container <\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<pre><code>\u00a0 \u00a0 \u00a0 \u00a0 args: \n\u00a0 \u00a0 \u00a0 \u00a0 - \"--ignore-db-dir=lost+found\"\n<\/code><\/pre>\n<ul>\n<li>\n<p>WordPress Connect to DB fail<\/p>\n<\/li>\n<ul>\n<li>\n<p>msg: <code>[Note] Access denied for user 'example username'@'x.x.x.x' (using password: YES)<\/code><\/p>\n<\/li>\n<li>\n<p>solution: wordpress can&#8217;t read env variables (so it kept default username: &#8220;example username&#8221;)<\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<pre><code>#change image to \nimage: wordpress:5.6.0-php7.4\n\n#ref: https:\/\/github.com\/docker-library\/wordpress\/issues\/576\n<\/code><\/pre>\n<ul>\n<li>\n<p>How to change a WordPress Multisite primary domain.<\/p>\n<\/li>\n<ul>\n<li>\n<p>wp-config.php<\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<pre><code>&lt;?php\n$domain = \"your domain\";\ndefine('WP_HOME', 'http:\/\/'.$domain.'\/\/');\ndefine('WP_SITEURL', 'http:\/\/'.$domain.'\/\/');\ndefine( 'WP_ALLOW_MULTISITE', true );\n...\n<\/code><\/pre>\n<pre><code>...\ndefine('MULTISITE', true);\ndefine('SUBDOMAIN_INSTALL', false);\ndefine('DOMAIN_CURRENT_SITE', $domain);\ndefine('PATH_CURRENT_SITE', '\/');\ndefine('SITE_ID_CURRENT_SITE', 1);\ndefine('BLOG_ID_CURRENT_SITE', 1);\n\n\/* That's all, stop editing! Happy blogging. *\/\u00a0 \/\/ &lt;--Before this line\n<\/code><\/pre>\n<ul>\n<ul>\n<li>\n<p>MySQL (Ref: <a href=\"https:\/\/wpengine.com\/support\/how-to-change-a-multi-site-primary-domain\/\" rev=\"en_rl_none\">https:\/\/wpengine.com\/support\/how-to-change-a-multi-site-primary-domain\/<\/a>)<\/p>\n<\/li>\n<ul>\n<li>\n<p>wp_options: value of &#8220;siteurl&#8221;, &#8220;home&#8221;.\u00a0 \u00a0 \u00a0(http)<\/p>\n<\/li>\n<li>\n<p>wp_#_options: each sub-blogs, also\u00a0value of &#8220;siteurl&#8221;, &#8220;home&#8221;.\u00a0 \u00a0 \u00a0\u00a0(http)<\/p>\n<\/li>\n<li>\n<p>wp_site: value of &#8220;domain&#8221;.<\/p>\n<\/li>\n<li>\n<p>wp_sitemeta:\u00a0value of &#8220;siteurl&#8221;.\u00a0 \u00a0(http)<\/p>\n<\/li>\n<li>\n<p>wp_blogs: all column &#8220;domain&#8221;.<\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<\/ul>\n<ul>\n<li>\n<p>Check version\/status<\/p>\n<\/li>\n<ul>\n<li>\n<p>&#8220;Tools&#8221; -> &#8220;Site Health&#8221; -> &#8220;Info&#8221;<\/p>\n<\/li>\n<\/ul>\n<li>\n<p>Need access to FTP issue.<\/p>\n<\/li>\n<ul>\n<li>\n<p>Msg: ask for ftp credential<\/p>\n<\/li>\n<li>\n<p>Ans:<\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<pre><code>This is user\u2019s permission problem that will be solved by method given below that worked for me.\n\nstep-1 : First open wp-config.php file of your wordpress installation folder.\nstep-2: Copy below code and paste it at the end of the wp-config.php file.\n\ndefine('FS_METHOD','direct');\n\nstep-3: Now open your droplet access console and enter root as username and its password.\nstep-4: Copy below code and paste it into access console where you have to specify your plugin directory path and then hit enter.\n\nchmod 777 \/yourwebsitename\/public\/wp-content\/plugins\/\n\nNote: Replace your website name in the place of yourwebsitename.\nThank you.\n\n<\/code><\/pre>\n<ul>\n<li>\n<p>ServerName not found\u00a0<\/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>.\u00a0<\/p>\n<\/li>\n<\/ul>\n<\/ul>\n<li>\n<p>Write parameter debug log\u00a0<\/p>\n<\/li>\n<\/ul>\n<pre><code>$sudo vi .\/your_wp_html\/wp-includes\/functions.php\n\n---\u00a0 functions.php ---\n...\n\/**\n* Simple helper to debug to the console\n*\n* @param $data object, array, string $data\n* @param $context string\u00a0 Optional a description.\n*\n* @return string\n*\/\nfunction debug_to_console($data, $context = 'Debug in Console') {\n\u00a0 \u00a0 \/\/ Buffering to solve problems frameworks, like header() in this and not a solid return.\n\u00a0 \u00a0 ob_start();\n\n\u00a0 \u00a0 $output\u00a0 = 'console.info(\\'' . $context . ':\\');';\n\u00a0 \u00a0 $output .= 'console.log(' . json_encode($data) . ');';\n\u00a0 \u00a0 $output\u00a0 = sprintf('&lt;script>%s&lt;\/script>', $output);\n\n\u00a0 \u00a0 echo $output;\n}\n...\n------\n\n\n# Now Usage in any .php file\n\n\ndebug_to_console($xxx)\n\n<\/code><\/pre>\n<p>Result:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2024\/10\/b79685d02b86436d5648f97c3a90537d.png\"\/><\/p>\n<p><b><span style=\"font-size: 14pt;\"><span style=\"color:rgb(250, 122, 0);\"><u>POSTS<\/u><\/span><\/span><\/b><\/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---\u00a0 functions.php ---\n...\n# Remove `$query->is_main_query()` check if needs \nfunction lmt_orderby_modified_posts( $query ) {\n\u00a0 \u00a0 if( $query->is_main_query() &amp;&amp; !is_admin() ) {\n\u00a0 \u00a0 \u00a0 \u00a0 if ( $query->is_home() || $query->is_category() || $query->is_tag() ) {\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 $query->set( 'orderby', 'modified' );\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 $query->set( 'order', 'desc' );\n\u00a0 \u00a0 \u00a0 \u00a0 }\n\u00a0 \u00a0 }\n}\nadd_action( 'pre_get_posts', 'lmt_orderby_modified_posts' );\n...\n------\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>GENERAL<\/p>\n<\/div>","protected":false},"author":1,"featured_media":3830,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-3831","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-posts"],"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=3831\" \/>\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=3831\" \/>\n<meta property=\"og:site_name\" content=\"John&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-31T13:03:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2024\/10\/b79685d02b86436d5648f97c3a90537d.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=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/john.pentaidea.com\/?p=3831\",\"url\":\"https:\/\/john.pentaidea.com\/?p=3831\",\"name\":\"WordPress FAQ - John&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\/\/john.pentaidea.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/john.pentaidea.com\/?p=3831#primaryimage\"},\"image\":{\"@id\":\"https:\/\/john.pentaidea.com\/?p=3831#primaryimage\"},\"thumbnailUrl\":\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2024\/10\/b79685d02b86436d5648f97c3a90537d.png\",\"datePublished\":\"2024-10-31T13:03:00+00:00\",\"dateModified\":\"2024-10-31T13:03:00+00:00\",\"author\":{\"@id\":\"https:\/\/john.pentaidea.com\/#\/schema\/person\/3d2e5980a7d3023e93b91d668d2a4a4f\"},\"breadcrumb\":{\"@id\":\"https:\/\/john.pentaidea.com\/?p=3831#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/john.pentaidea.com\/?p=3831\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/john.pentaidea.com\/?p=3831#primaryimage\",\"url\":\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2024\/10\/b79685d02b86436d5648f97c3a90537d.png\",\"contentUrl\":\"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2024\/10\/b79685d02b86436d5648f97c3a90537d.png\",\"width\":2105,\"height\":234},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/john.pentaidea.com\/?p=3831#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=3831","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=3831","og_site_name":"John&#039;s Blog","article_published_time":"2024-10-31T13:03:00+00:00","og_image":[{"url":"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2024\/10\/b79685d02b86436d5648f97c3a90537d.png"}],"author":"jj","twitter_card":"summary_large_image","twitter_misc":{"Written by":"jj","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/john.pentaidea.com\/?p=3831","url":"https:\/\/john.pentaidea.com\/?p=3831","name":"WordPress FAQ - John&#039;s Blog","isPartOf":{"@id":"https:\/\/john.pentaidea.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/john.pentaidea.com\/?p=3831#primaryimage"},"image":{"@id":"https:\/\/john.pentaidea.com\/?p=3831#primaryimage"},"thumbnailUrl":"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2024\/10\/b79685d02b86436d5648f97c3a90537d.png","datePublished":"2024-10-31T13:03:00+00:00","dateModified":"2024-10-31T13:03:00+00:00","author":{"@id":"https:\/\/john.pentaidea.com\/#\/schema\/person\/3d2e5980a7d3023e93b91d668d2a4a4f"},"breadcrumb":{"@id":"https:\/\/john.pentaidea.com\/?p=3831#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/john.pentaidea.com\/?p=3831"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/john.pentaidea.com\/?p=3831#primaryimage","url":"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2024\/10\/b79685d02b86436d5648f97c3a90537d.png","contentUrl":"https:\/\/john.pentaidea.com\/wp-content\/uploads\/2024\/10\/b79685d02b86436d5648f97c3a90537d.png","width":2105,"height":234},{"@type":"BreadcrumbList","@id":"https:\/\/john.pentaidea.com\/?p=3831#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\/2024\/10\/b79685d02b86436d5648f97c3a90537d.png","_links":{"self":[{"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/posts\/3831","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=3831"}],"version-history":[{"count":0,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/posts\/3831\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=\/wp\/v2\/media\/3830"}],"wp:attachment":[{"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3831"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3831"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/john.pentaidea.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3831"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}