Archive

Tweaking WordPress.com

v1.6.0 of the classic editor redirect script is out! I may be very inactive on WordPress these days, but I’m still committed to providing updates to these scripts when they break. If something’s broken, please create a GitHub issue or let me know in the comments. Thanks to musicdoc1 for reporting again this time!

As usual, your script should have updated itself, but if not, you can head over to Greasy Fork and install it manually.

This change also affects the bookmarklet, so if you use the bookmarklet method, please replace it with the new version (delete the old one and re-add the new one). You can get the updated code on the workarounds page.

For the technical details, you can go look at commit bfe80e4. In the last week or so, WordPress.com has started redirecting classic wp-admin editor URLs to the new editor. The classic-editor query parameter is needed to prevent the redirect. Adding the new parameter was very simple, but more code was needed to prevent an infinite redirect loop. In a later commit, the code has also been reformatted and lightly refactored to make it look nicer.

I fear that this change means the classic editor is on its last legs and we may see it disappear altogether in the next change, so we should enjoy the classic editor while it’s still here.

If you have any troubles, please leave a comment and I’ll be happy to help you troubleshoot. Happy blogging!

My stats sparkline script has been updated to v1.2.0! I noticed that I no longer had a sparkline because WordPress.com removed something the script was relying on, so I reworked it to rely on something else instead. I hope I didn’t break custom domains; let me know in the comments if I did.

If you have auto-update enabled for the script, you should receive the update soon. Otherwise, you can force an update check for the script in your extension or head over to Greasy Fork and install it manually.

For the technical folks out there, you can view the diff to see the actual changes. WordPress.com previously had a sliding drawer that came out when you clicked the “My Sites” button in the WP Admin Bar, but that no longer seems to exist. The script had been relying on the sparkline that was present in that drawer, but since it no longer exists, the script failed. I changed it to build the URL manually; thankfully I had an example saved.

Happy blogging!

v1.5.0 of the editor script is out! This version fixes an issue where the script does not redirect for private blogs and some Jetpack blogs. If you don’t have such a blog, then this update shouldn’t affect you. Thanks go to doc for reporting the issue.

As usual, your script should have updated itself, but if not, you can head over to Greasy Fork and install it manually.

This change also affects the bookmarklet, so if you use the bookmarklet method, please replace it with the new version (delete the old one and re-add the new one). You can get the updated code on the workarounds page.

For the technical details, you can go look at commit e41fe77. It seems that sometime in the last two years, WordPress.com changed the structure of the editor page, so the query used was incorrect. The change was simply changing the query selector to better target the element with the link.


As many of you know, Firefox 57 has been out for a couple of months now. In it, Mozilla dropped support for XUL add-ons, leading to many add-ons becoming incompatible with Firefox 57. Greasemonkey and Scriptish, two popular add-ons for Firefox that enable you to run user scripts like the editor redirect script, are both XUL add-ons and therefore incompatible with Firefox 57.

Some of you have brought your migration issues to my attention, so I figured I’d share the procedure here so the rest of you can spread the word. Apologies for taking so long to get this out.

Just to note, the scripts themselves don’t need any changes.

  1. Make sure Greasemonkey has been updated to the latest version. It should be at version 4 or higher.
  2. Reinstall the scripts you want (quick link to all my scripts).
  3. Try out the script. If it works, then stop here.
  4. Make sure that both Greasemonkey and the scripts are enabled. Restart your browser if you still have troubles.
  5. If Greasemonkey fails to work or is not complete enough for you, uninstall it and install your scripts with Tampermonkey or Violentmonkey instead.

Greasemonkey has worked when I tested it, but the reports I’ve heard say that it doesn’t, so you may want to consider skipping to the last step and using one of the alternatives.

I’ve also updated the relevant section in the workarounds page.

If you have any troubles, please leave a comment and I’ll be happy to help you troubleshoot.

I released v2.3.0 of the Classic Stats Redirect script on Sunday. Your copy should have automatically updated already. If you don’t already have the script or need to update manually, you can download your copy from Greasy Fork. Special thanks go to Dennis for helping me test out this version!

After the incident causing the release of v2.2.1 (I apparently neglected to announce v2.2.0 and v2.2.1; this release suppresses redirection for URLs containing from=wp-admin), I decided that I should write some automated tests to catch these kinds of errors before I end up releasing them. I will discuss the issue in the technical section that follows.

This update is purely a refactor and the behaviour should be the same. If anything has changed, please leave a comment or file an issue.

Technical details →

My stats sparkline script has been updated to v1.1.0! This version adds support for custom domains.

If you have auto-update enabled for the script, you should receive the update soon. Otherwise, you can force an update check for the script in your extension or head over to Greasy Fork and install it manually.

If you own a custom domain, you have an extra step to do, again because of technical limitations. By default, the script won’t run on your custom domain because it doesn’t know about it. To fix that, find the script in your user scripts extension (Greasemonkey, Tampermonkey, etc.), go to the script’s options and add the following as a user include, where example.com is your custom domain:

https://example.com/*

If your extension doesn’t support user includes, you will have to edit the script manually, although doing this means you won’t get automatic updates and you will have to do this every time you update. If you need to this, add the following line after the existing @include line:

// @include https://example.com/*

A big shout-out goes to Dennis for alerting me of the bug and helping me test! This release couldn’t have happened without him.

If you’d like to read about the technical details of the update, continue reading. Otherwise, if you have any questions or experience any issues, please leave a comment. Happy blogging!

Technical details →

The staff at WordPress.com are at it again, removing useful features for the sake of consistency with the “unified experience” vision. This time, it’s the stats sparkline in the admin bar that was introduced in 2011. It still lives on hidden in the sidebar that appears when you click “My Sites” in the admin bar, but its usefulness is greatly reduced because it’s hidden in the sidebar and not immediately visible in the admin bar.

This was unacceptable, of course, so I wrote a script to bring it back. Unfortunately, because of certain technical limitations, this script can only run on URLs that have wordpress.com in the domain part. If you want to add support for your custom domain, you will have to extend the script’s include directives. You can add one in the script’s options in your extension. If your extension doesn’t support adding custom includes, you can add it yourself by adding a custom @include line to the script, but you won’t be able to receive automatic updates.

The sparkline restored to the admin bar

The sparkline is restored

If you’ve already installed one of my previous scripts, you’ll know how easy it is to install this one. If installing user scripts is new to you, don’t worry; it’s very simple. If you don’t already have one, install a browser extension that allows you to run user scripts. Then, install the script from Greasy Fork.

If you have any questions or experience any issues, please leave a comment.

You don’t need to know how the script works to use it, but if you’d like to know the technical details, read on. The source code is available on GitHub.

Happy blogging!

Technical details →

v2.1.0 of my classic stats redirect script has been released! As I had mentioned in my previous release post, v2.1 of this script features support for redirecting when there is no blog domain in the URL. This is the case for /stats, /stats/insights, /stats/day, and the others stats types. Unfortunately, due to the nature of the solution, the page must load first before you are redirected. Fortunately, though, this probably isn’t a very common case.

The script was updated earlier today, so you may have already received the update if you have auto-updating enabled for the script. Otherwise, you can install the new version manually from Greasy Fork. Leave a comment if you experience any issues or have any questions.

Technical details follow.
Read More

Version 2.0.0 of my classic stats redirect script is out! I had actually released it on Thursday, but I didn’t get a chance to write this post until now. If you have auto-updating enabled for the script, which is the default, you should have already received the update. Otherwise, you can head over to Greasy Fork to install it manually. This new version redirects instead to the classic dashboard stats page. Thanks goes to PiedType for alerting me of the problem and to Dennis for the idea for the solution.

If you would prefer to use the new stats page and would like to use your screen space a little more, you can install my stylesheet that does that.

If you’d like to learn more about how the script works, keep reading. Otherwise, you can stop here and enjoy your classic stats! Leave a comment if you have any trouble setting it up or if you have any questions.

Insights and technical info →

WordPress.com’s new editor was updated on November 16 and it broke redirecting for private and Jetpack-enabled blogs. Specifically, the fallback link to the old editor was removed, so the script could not scrape it and redirect to it.

Those of you who are using the script already and have automatic updates enabled (it’s probably enabled by default) should get an update to v1.4.0 soon. Otherwise, head over to Greasy Fork and install the script manually.

As a result of the update, redirection for Jetpack-enabled blogs whose site root and installation root differ fails again. Until someone figures out how to hijack the API proxy that the editor uses, this will stay broken.

Please report any issues you come across and I will try to fix them as soon as possible.

Technical details →