GENERAL
-
Upload file size limit of wordpress
-
apt update
-
apt install -y vim
-
vi .htaccess
php_value upload_max_filesize 200M
php_value post_max_size 200M
php_value max_execution_time 300
php_value max_input_time 300
-
MySQL can’t initialize DB, dir not empty
-
Add to mysql deployment-container
args:
- "--ignore-db-dir=lost+found"
-
WordPress Connect to DB fail
-
msg:
[Note] Access denied for user 'example username'@'x.x.x.x' (using password: YES) -
solution: wordpress can’t read env variables (so it kept default username: “example username”)
#change image to
image: wordpress:5.6.0-php7.4
#ref: https://github.com/docker-library/wordpress/issues/576
-
How to change a WordPress Multisite primary domain.
-
wp-config.php
<?php
$domain = "your domain";
define('WP_HOME', 'http://'.$domain.'//');
define('WP_SITEURL', 'http://'.$domain.'//');
define( 'WP_ALLOW_MULTISITE', true );
...
...
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', $domain);
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
/* That's all, stop editing! Happy blogging. */ // <--Before this line
-
MySQL (Ref: https://wpengine.com/support/how-to-change-a-multi-site-primary-domain/)
-
wp_options: value of “siteurl”, “home”. (http)
-
wp_#_options: each sub-blogs, also value of “siteurl”, “home”. (http)
-
wp_site: value of “domain”.
-
wp_sitemeta: value of “siteurl”. (http)
-
wp_blogs: all column “domain”.
-
Check version/status
-
“Tools” -> “Site Health” -> “Info”
-
Need access to FTP issue.
-
Msg: ask for ftp credential
-
Ans:
This is user’s permission problem that will be solved by method given below that worked for me.
step-1 : First open wp-config.php file of your wordpress installation folder.
step-2: Copy below code and paste it at the end of the wp-config.php file.
define('FS_METHOD','direct');
step-3: Now open your droplet access console and enter root as username and its password.
step-4: Copy below code and paste it into access console where you have to specify your plugin directory path and then hit enter.
chmod 777 /yourwebsitename/public/wp-content/plugins/
Note: Replace your website name in the place of yourwebsitename.
Thank you.
-
ServerName not found
-
Msg:
-
FQDN not found
-
mysqli connection exception, server name not found
-
Ans:
-
Rebuild wordpress after cleaning all old data on disk.
-
Write parameter debug log
$sudo vi ./your_wp_html/wp-includes/functions.php
--- functions.php ---
...
/**
* Simple helper to debug to the console
*
* @param $data object, array, string $data
* @param $context string Optional a description.
*
* @return string
*/
function debug_to_console($data, $context = 'Debug in Console') {
// Buffering to solve problems frameworks, like header() in this and not a solid return.
ob_start();
$output = 'console.info(\'' . $context . ':\');';
$output .= 'console.log(' . json_encode($data) . ');';
$output = sprintf('<script>%s</script>', $output);
echo $output;
}
...
------
# Now Usage in any .php file
debug_to_console($xxx)
Result:

POSTS
-
Order posts by last modified/update date
$sudo vi {your_wp_html}/wp-content/themes/{your_current_theme}/functions.php
--- functions.php ---
...
# Remove `$query->is_main_query()` check if needs
function lmt_orderby_modified_posts( $query ) {
if( $query->is_main_query() && !is_admin() ) {
if ( $query->is_home() || $query->is_category() || $query->is_tag() ) {
$query->set( 'orderby', 'modified' );
$query->set( 'order', 'desc' );
}
}
}
add_action( 'pre_get_posts', 'lmt_orderby_modified_posts' );
...
------
Leave a Reply