Get rid of “Another update is currently in progress” in WordPress

When you updating one of your resources in wordpress, accidentally you close the window (that’s what I did).

Then when you try to update it again, there is still another process already running. You need to get rid of this before you continue.

Use wp-cli:

wp option delete core_updater.lock

Minify html output with simple php function

It’s always a pleasure to have html tags tidy and attached to one another. especially if these html tags are yours in your website. To have this we can do with a simple php function. Place the code below at the top of header php page or index page.

<?php
function sanitize_output($buffer) {
  $search = array(
    '/\>[^\S ]+/s',
    '/[^\S ]+\</s',
    '/(\s)+/s',
    '/<!--(.|\s)*?-->/'
  );
  $replace = array(
    '>',
    '<',
    '\',
    ''
  );
  $buffer = preg_replace($search, $replace, $buffer);
  return $buffer;
}
ob_start("sanitize_output");
?>

How to change wordpress homepage URL

I moved my wordpress blog from my localhost to new hosting (new domain), and I was lazy to install the new one and I just copied all of my directory and upload it to new hosting. After a few configuration, my blog back to online with new domain, but the home page url was still referring to old url (my localhost url).

Few minutes later after googled the problem, I found out these two lines need to be added in wp-config.php, just put these damn codes at the top before database configuration.

define('WP_HOME','http://your-new-url.com');
define('WP_SITEURL','http://your-new-url.com');

and save to override the homepage url stuck.