WordPress.com Classic Editor script updated for new editor

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.


To go into a little technical detail about the changes in the script, the biggest change is in how private and Jetpack-enabled blogs are handled. Previously, the script would scrape the page for the fallback edit link. Since that link has been removed, the URL has to be built. The new URLs use the domain name as the blog ID instead of the numeric ID, so that’s used to build the editor link when available. This means that redirects for private blogs now have the potential to be faster than before. However, when the URL still contains a numeric ID, the script scrapes the page for the domain, specifically in the “Visit Site” box in the top-left, and uses the site address that it gets to build the link.

As for Jetpack-enabled blogs, public Jetpack-enabled blogs are now handled the same way as public WordPress.com blogs since scraping the page for the site link would produce the same link as an API call.

Feel free to dig into the code (excuse the mess) and ask questions or send pull requests. Although mostly outdated, the in-depth look at how v1.0.2 worked is still somewhat relevant as the basic idea is still the same. Between then and now, functionality for handling pages and private blogs have been added.

Advertisements
7 comments
  1. Thanks again for making this available to us. It is most appreciated! Cheers!

  2. Hi Penguin, if you have the time and interest, would you like to make a user script to remove the annoying sentence and link to the new editor that is on the classic editor, “There’s now an easier way to create on WordPress.com! Switch to the improved posting experience.”?

    Here’s the Forum thread: https://en.forums.wordpress.com/topic/a-request-to-staff-to-remove-permalink-to-new-editor-from-wp-admin-editor?replies=8#post-2502998

    Thanks in advance. Cheers!

    • Certainly! I’ll leave it to you to announce it however you wish.

      Luckily, it was a mostly-trivial thing to do, so it didn’t take much time. It may be prone to breakage, though, because it assumes the message is always the first (which is what I saw from my investigation). It also only works on wp-admin links that have sitename.wordpress.com in the URL, but it’s an easy change to have it support other domains.

      The hack is in the form of a user style and you can use the Stylish add-on to install it:
      https://userstyles.org/styles/120992/hide-link-to-new-wordpress-com-editor

      If you don’t have Stylish and would rather not install it just for this one thing, the site also gives you an option to install it as a user script in Greasemonkey/TamperMonkey/whatever.

      • Wow, Penguin, you are the best! Thank you so much for taking the time to make this user script for us. I just installed it and clicked on New Post and it works! Huge Cheers to you! I’ll report this on the thread so others can install it.

  3. zaosan said:

    Thanks Penguin for giving me back the ease of the classic editor!
    My cyber blessings pal.

`$name' says...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: