Muschamp Rd

New Year, New WordPress

January 10th, 2019
WordPress Upgrade Success

It has been over two years since I did a major upgrade to this WordPress blog. I managed to keep it online through a lot of trials and tribulations and although my job search is my number one priority and I bought my ticket back to Canada, I will be in China until the end of the month for “reasons” so putting off fixing all the flaws in this blog is not something I will be putting off anymore.

I still do not think the ROI for blogging has been worth it but I’m hopeful I can leverage this blog and social media more in my job search. And I’m definitely planning on improving my IT skills so Python is on the backburner as debugging PHP and JavaScript as well as even less savoury topics like .htaccess and mod_rewrite have become a necessity. I actually spent a lot of time working on my style.css file, I’m old school that way in using HTML and CSS over JavaScript to solve problems.

Before Upgrading WordPress, Backup!

I finally removed Mint and I made my homepage run faster but this blog is a bigger beast with a lot of old code that needs upgrading or completely replacing. My next step will be getting rid of years of revisions to blog posts and cleaning up my MySQL database even further. Then I will take the plunge and upgrade to WordPress 5.something. Before I do that I will make a backup, maybe even two backups, one of the database and you can also export your posts as XML.

Before WP-Sweep

I used WP-Sweep to remove old blog post revisions of which there were a lot. This reduced the size of my MySQL database by 51 MB apparently. I never did a backup before I removed Mint because I didn’t want that data back, most of it is duplicated in Google Analytics.

Upgrading to WordPress 5.0.2 went really smoothly. My website is noticeably faster with all the plugins turned off and my call in functions.php to commented out. I’m not sure what plugin required that, but considering how slow my blog was running from inside China as 2018 ended, some plugins are definitely no longer welcome on Muskblog.

Formerly Active Plugins

  • Blog Metrics
  • Bulk Delete
  • Disqus
  • Featured Images in RSS w/Size & Position
  • Google Analytics for WordPress
  • Google XML Site Maps
  • HeadSpace2
  • JetPack
  • Not-to-me
  • Ozh’ Spam Magnet Checker
  • Recent Post Widget with Thumbnails
  • Regenerate Thumbnails
  • Simple Tags
  • Simple Trackback Validation
  • WPtouch
  • WP-Sweep

Sitting installed but inactive were the following plugins:

  • Dump Environment
  • Simple Random Quotation
  • Site Unavailable
  • User Spam Remover

WordPress 5.0.2 Successfully Installed

Minimal WordPress Plugins

The first thing I’m going to add back is likely Google Analytics, since I already left a plain Jane comment on a post. Many of these plugins may never be reactivated after how slow my blog got from inside China. I’m going to watch to see which ones hit against blocked services very carefully.

How my comments look with WP-TouchI added back the following plugins in the following order and only one gave me any grief at all. My website is running so much faster, but I fear the spam and brute force attacks will hit soon. I’m going to leave it running with just these six plugins for a few hours and work on the upgrade more in the morning.

  1. Google Analytics for WordPress
  2. Blog Metrics
  3. Ozh’ Spam Magnet Checker
  4. YARPP
  5. Recent Post Widget with Thumbnail
  6. WPtouch

With just those six plugins I got the dreaded deluge of spam, so I adjusted some options, then I added Akismet and still I get spam. I think I will be disabling trackbacks and pingbacks or at least not showing them. Years ago when I put this blog online I thought they were pretty cool, but now they just get abused by spammers and for old posts they make the comment section look weird. Many advise removing them from your blog. I also will need to style my comments better, WP Touch did a much nicer job.

Here Be Spam

Here are some tutorials I used to improve how comments look on my blog, I think I was still doing things the WordPress 1.0 or 2.0 way.

I didn’t quite get threaded comments to work at first, though I did make my existing threaded comments look better. It appears I never updated my theme sufficiently for WordPress 2.7. I’ve been using plugins to handle comments for at least that long. I also discovered some duplicate comments, so cleaning that up is also going on my “to do” list but I want to get this post finished which means I must push on with slightly wonky comments at the moment. I did create two threads on StackExchange however:

  1. How best to check if a user is from China and hide content?
  2. Why are my threaded comments not quite working?

I did finally get threaded commenting working, the answer was a line of code in header.php and a few other changes to comments.php as detailed by Ottodestruct

Replacing WordPress Plugins

I then started replacing plugins, the first to go was HeadSpace2 which has not been updated in six years apparently. I used it to add exactly one metatag. It will be replaced by Yoast SEO. That is another big plugin which is actively under development and should preserve my data. The other two plugins which are on the way out are JetPack and Disqus. JetPack is just too big in my opinion and seems to do a lot in my wp_header and wp_footer. It has two main features I was using: metatags for Facebook and Twitter and the social sharing buttons. It does more and it might be fighting spam and malicious login attempts too, but supposedly upgrading WordPress will help with security and speed.

You can spend a lot of time following search engine optimization advice from Yoast and others. I really, really want to get this post published before the end of 2019.

209 bad internal linksUpdate: I’m not sure if it is a big issue in SEO anymore but in the olden days having busted links on your homepage was considered a negative signal as far as quality, but as the web has gotten bigger and personal homepages have gotten bigger, regularly running a link checker on your content has gone the way of the dodo. Worse, domain squatters pass the automated link checkers, but they can be a much bigger problem to your search engine optimization efforts than a busted link. As part of my new year, new WordPress upgrade I fixed 100s of bad links, most of them were pingbacks making them even less desirable in my eyes. I also discovered more duplicate comments, after thinking I’d deleted them all before I got around to checking links.

Disqus seems to have become blocked in China. It also adds another Twitter and Facebook button and it does miscellaneous unwanted tracking, it will even advertise on my site, if I let it. It definitely slows my whole blog down in China and hardly anyone comments on what I post. My fear like removing JetPack is suddenly a host of spammers will descend on me, but again WordPress out of the box has more resiliency and features than it did originally.

I really want my blog to run better in China so people who are still in China or who travel to China can make use of it. I can’t unblock Instagram or Pinterest so images embedded from Flickr or self-hosted images are clearly the way to go. I will hide or remove as much social media and calls to blocked services as I can. JetPack does not give me a way to hide the social media buttons from Chinese web surfers so I may add them to my post the old fashion way assuming Yoast SEO will take care of the metadata. I could even try getting Professional Share to work again but it didn’t support Pinterest and I believe conflicted with WPtouch which although very JavaScript heavy, seems to function in China well.

More Blogging Difficulties

This was a long and thorough upgrade and while deleting duplicate comments by hand I discovered my website slowing way down and seeing as speed was the reason behind this upgrade I viewed source and discovered something is inserting a coinhive mining script. Is this in the WordPress source, a plugin on this list, is it from public WiFi in China, needless to say I’m going to try and find out.

How did this get into my blog or browser?

I haven’t seen this injection attack again so this was likely caused by being on public WiFi in China. I was in a cafe where I’ve spent too much time studying and looking for a new job. The cafe in question was a Wagas near Dashijie metro station, so beware using public WiFi in China as if that truly needed stating. Update: I caught them again inserting this mining script while I was debugging my blog theme in their cafe.

Beware the WiFi at Wagas is inserting Coinhive mining scripts into your browser

Further Improving My WordPress Theme

There are still at least two outstanding issues I haven’t fixed plus I need to tweak and debug the CSS more, but this post has got to be published. Yoast SEO doesn’t seem to think it is particularly well written and I’m not looking forward to going through old blog posts and improving them to make a plugin happy, but at least the metadata and sitemaps seem to be working. I decided on a sitemap for categories but not for tags. I did include a tag cloud when you look at a tag archive but I did not use a plugin. This blog was much leaner and meaner until I discovered the Coinhive issue.

The Need for Speed

Google thinks my homepage is fast

Apparently I know how to code a webpage so that it loads fast, WordPress along with gee-whiz plugins are slower. I will continue to optimize including finally trying a caching plugin, that might be enough. The other things I can do for speed is get rid of YARPP, which I’ve discovered has been removed from the repository. It was a lot of effort to get good related posts to work and look good on my blog. I’m not sure what to do with this new tidbit of information. There are alternatives and there is data that shows JetPack is quicker I already had to add back Akismet maybe I have to go back to using JetPack.

Google thinks my blog is less fastGoogle provides a lot more tools than they used to for developers and browsers also provide developer tools now. I’ve updated websites using the most primitive of toolsets so it isn’t a surprise that my hand-coded content runs quicker than a modern content management systems, but if you have a lot of content or plan to produce more and more content you need some sort of CMS.

Related Posts Have Proven Problematic

After removing YARPP I switched to a plugin called Yuzo Related Posts. Then in April I discovered my blog was no longer accessible and was being redirected to spammy and phishy websites. My webhost was no help but the support forums and Google provided more information. Now I must decide if I will once again try to get related posts working or follow Yoast’s advice and just carefully choose my internal links and calls to action.

The advantage of a related posts algorithm is if you have years of old posts, you will not remember them all and you will not want to edit hundreds of old posts and relink, but that is what I’ve been doing in 2019 while looking for a job. But I did not enjoy waking up to learn my blog was gone. I had to uninstall the plugin and write some SQL but before that I also made backups and changed my password apparently being hacked is not uncommon in 2019.

Ongoing Search Engine Optimization Efforts

I made a long advocated change to my WordPress theme changing single.php to use H1 for the blog post title. On category archives I was using H1, H2, and H3 logically. This necessitated a lot of trial and error changes to my style.css file and the adding of a single break tag as I could not quite get it to work just using CSS. I may switch to a clear div and I’ve moved breadcrumbs to header.php but I also seem to have introduced a bug into my pager styling. I’ve also been updating and optimizing a lot of text in older blog posts strategically, eventually I will have edited every blog post I’ve ever written, I’ve also been deleting content that isn’t helping with my search engine optimization efforts or more importantly my job search.

New Editor, New Problems

I started writing my first new post in WordPress 5, this post was started in a previous version of WordPress and did not use the new editor. I’m not sure how having to click a button every time I want to add a new paragraph is faster than just hitting the “return key”. Same goes if you want to add an image or anything else you must first add a “block”. Although I turned off the related plugin post, what I really want to get rid of are self-pingbacks. I’ve been interlinking my blog for over a decade and on some posts there are a lot. There appears to be a way to do this built into wp_list_comments(), just set ‘type’=>’comment’.

Mobile Matters

In WPtouch they do not show up by default, but in both cases are included in the count of total comments. They are nofollow’ed by default anyway, the time of pingbacks and trackbacks has passed, it is all about social sharing and I don’t have any of those buttons at the moment for speed. Most people know how to share on their phone and computer by now. WPtouch really controls the speed of my blog on mobile, updating to the latest version helped, turning off YARPP didn’t make much of a difference to mobile page speed according to Google, but it must be replaced due to being widely banned.

Overdue for a new modern WordPress Theme

Although I’ve been spending the majority of my time tweaking my CSS and updating old posts to be “better”. I have also already selected my five pieces of cornerstone content. But the ultimate improvement I could make to this website would be to replace this theme and all the static HTML with more modern HTML, I think I will also downsize my website even further at some point as social media now is much more important than it was when I originally created this website.

Tall Skinny Images Trouble Gutenberg

I encountered difficulties floating a tall skinny image to the right of my text in Gutenberg something I had adopted doing as they share best on Pinterest. I searched the Internet but eventually created another StackExchange question for this problem. Although my latest greatest post about China clearly was not quite ready for prime time and I obviously need to upgrade my theme more, I had to publish so people could see the HTML in the wild and try to figure out what CSS rule or whatever is my problem. I’d already spent hours debugging it.

Updating to a more modern WordPress theme perhaps one based on underscores might be wise. I did make a blank theme back in the day but I have not had time or the need to be on the cutting edge of WordPress. I have had much bigger problems, but once again being unemployed I have invested time in updating skills and updating and improving this website.

If you have thoughts, fixes, insights, tips, or snide comments please leave them below. Social sharing buttons may make a return but not right away. I think this mining script being injected into my blog along with a plugin I installed being exploited are much bigger problems.

Finally updating WordPress again in 2024

I have been so busy the last few years I have not updated WordPress or fixed issues with my website. My CSS may be starting to show its age and last time I upgraded I had to fix my theme I recall. I’m not even sure what the latest WordPress version is. But I’ve done this many times so I will disable plugins, I downloaded a database backup already. I haven’t even fixed Google Analytics that is probably a next weekend problem, because I do want to do my traditional year end blog posting even though most of my blogging is done elsewhere. Hopefully Muskblog lives to fight another year.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Posts on Muskblog © Andrew "Muskie" McKay.
CFA Institute does not endorse, promote or warrant the accuracy or quality of Muskblog. CFA® and Chartered Financial Analyst® are registered trademarks owned by CFA Institute.