Emoji on Old Posts Are Back, Baby!

I might’ve made a teeny, tiny little error when doing the database dump of the old site, so when I imported the file, all of the emoji on old posts/pages turned into question marks. 😅

In my defense, mysqldump really should’ve used the correct UTF8 encoding by default, but I fixed it by adding the –default-character-set=utf8mb4 flag and running it again.

Because I’d made a new post, it was a little tricky to update the DB, since importing a dump file overwrites everything. But because I loved all of your comments on the New Server post (so many of you have wildlife!), I exported that post directly and reimported it using WordPress’s default import/export functionality, which is pretty good!

I *think* everything should be good now, but I’m still slowly fixing the CSS. I made the mistake of resetting my Astra theme preferences so I’d be using the latest and greatest… and the latest and greatest isn’t that great, actually. I could revert, but I figure I’m in the future now, so I might as well embrace it. Grouchily. If you see weirdness with the site layout, that’s why. :)

WP-Cron, BackWPUp, and Apache Virtual Hosts

We were forced to switch hosts recently, and while setting up the new server, I ran into a really frustrating issue with wp-cron that had a stupidly simple fix.

Some background: I setup several virtual hosts with Apache that redirected based on the domain name. This is a fairly common setup for running multiple domains from a single server. To test, I modified my local hosts file to redirect the domains to the new server. The actual DNS record was still pointing to the old server until I had everything ready. This becomes important.

Everything seemed to be working correctly but when I’d run a BackWPUp job, nothing would happen. It would say the job was started, but it wouldn’t show me the job running page. It wouldn’t do anything.

Some searching seemed to indicate that this was related to wp-cron. And indeed, wp-cron was not running. Scheduled posts wouldn’t get posted. But none of my searches turned up anything. Wp-cron just wouldn’t run and there was no reason why.

Some digging showed that wp-cron wasn’t even in the access log. In the default setup, wp-cron gets called when someone visits your site. But it gets called via a callback to domain name/wp-cron. This means the server sends the request to the old server if you haven’t updated your DNS.

The stupidly simple fix? Add the virtual host domains to the /etc/hosts (or wherever, depending on your server) with the IP set to the local IP.* Boom. Everything works. It took me an embarrassingly long time to figure this out.

*Alternatively, you can just update the DNS to point to the new server when you’ve hit this point.