What’s New in Revisions for WordPress 3.6

Getting to the revisions screen is easier than ever with a new link in the Publish meta box.
Getting to the revisions screen is easier than ever with a new link in the Publish meta box.

The All New Revisions UI and numerous bug fixes!

The revisions system in WordPress has been given a complete overhaul in the new (upcoming) Version 3.6 of  WordPress.  The new version of revisions patches several longstanding bugs and issues with the revisions system and introduces a slick new user interface for viewing and comparing revisions.

The new interface uses a scrollbar and features two modes – a single handle mode where each revision is displayed indicating whats changed in that revision, and a two handled mode where users can compare any two revisions stored in the system and see whats changed between them. Significant effort was put into making the process as fast as possible, and the JavaScript interface means it’s quick to find the revision you are looking for and restore it.

The revisions interface focuses on two primary use cases: undoing mistakes by finding the last correct revisions, and reviewing changes as part of an editorial workflow. To improve these uses, a completely new UI was created, and numerous bugs were fixed.

Highlights of  new Revisions features for WordPress 3.6

  • Revisions Rewrite using Backbone.js – this complete iStock_000010243941XSmall-200x300reworking of the way users interact with the stored revisions combines immediate screen updates with a scroller that makes exploring revisions quick and easy. Massive effort was put into refining, testing and improving the system – it allows rapid scrobbing through up to hundreds of revisions. Quickly locate the revision you need and restore it; also allows comparing of any two revisions – no more clicking and waiting to see a comparison, just scroll through to find the revision you need – #23497
  • Store a copy of the current post data as a revision – keep the revisions data current – previously only the previous save was stored as a revision, now the current save is stored as a revision. #16215
  • Filter to override WP_POST_REVISIONS (or define it later) – allows you to disable or set the number of revisions allowed on a per site basis setting on a multisite install – #22289
  • Pass post ID to post revision field filter – #19932

 

What’s Fixed in Revisions for WordPress version 3.6

Previous versions of WordPress had several problems with the revisions system that have been corrected in the 3.6 release. The following significant bugs were addressed in this release cycle:

  • Duplicate autosave/revisions clutter the database (because revisions are saved even if nothing has changed) – #9843
  • Extra revision created every time a new post is inserted – by the first time you published a post, there were already two revisions – #24708
  • Restoring post revisions does not update _edit_last – now the revisions system tracks who last restored a post revision – #20982
  • Post Revision history displays the incorrect author – the old system stored a revision before updating a post, yielding bad data that 3.6 corrects. #16215

 

Contributing to WordPress core

Recently, I started contributing to WordPress core. I’ve decided to hone my WordPress skills beyond writing WordPress plugins.

Contributing code patches to core is exciting because they get scrutinized by some top notch programmers I admire, and if accepted, get used directly in WordPress. I’ve also been testing bugs and other people’s fixes when I can, but creating patches is the most part exciting so far! My first patch was tiny and accepted without a change, most of the rest have been more complex and needed little fine tuning. Along the way I’m learning more about the WordPress core than any normal person needs to know.

Here are some patches I’ve contributed recently:

  • #22919 – my first, patch, accepted and committed by nacin. grin:). fixed a javascript type mismatch
  • #22606 – ‘select a file’ link doesn’t work from keyboard, accessibility issues – added javascript fix
  • #22933 – tabbing out of text edit area went to wrong field, fixed bug in code
  • #21334 – fixed accessibility issue with quick edit panel, two possible patches
  • #23120 – fixed issue with unclear/no confirmation on widget save/reorder
  • #22896 – eliminate possibility of removing bundled jQuery when in Dashboard
  • #22917 – user/site count not updating (immediately) after adding/removing user/site(s)

It took me a little bit of time to get the local setup for debugging and coding WordPress core, but mainly because I haven’t done anything quite like that before. Now that everything is set up locally, I can work on fixing bugs or testing fixes quickly and efficiently. When I find a bug I can fix, creating the patch file is as simple as a command line command away, especially as outlined in Mark Jaquith’s Toolbox.

Enforcing _blank target on external links

When training new clients on how to edit their own websites in wordpress, I often mention the convention of ‘targeting blank’ when linking to another website. Adding the ‘target=”_blank”‘ tag to the link opens a new window when the user clicks the link, leaving the client website open in the background . Still, I know clients will forget this so I often add a little JavaScript code to make sure the links are always set to target blank:

Since I know all my wordpress sites include jQuery, I use that library to make the call as compact as possible:

CODE:
$(document).ready(function() {
$(“a[href^=’http:’]”).
not(“[href*=’CLIENTDOMAIN.COM’]”).
attr(‘target’,’_blank’);
});

what does it do? it finds all links that start with http:, then filters out (not) those links that go to the CLIENTDOMAIN.COM (their domain name), then it sets the ‘target’ attribute to ‘_blank’, linking all external links on the

Web Development Enters a New Era

Web publishing platforms such as WordPress have reached a maturity level that allows developers to deploy robust websites managed and maintained by clients. The developers role becomes focused on design and implementation, while content development is client driven. Modern libraries like jQuery and the WordPress plugin mechanism mean that ideas and projects that used to take days or weeks to implement and debug now take just minutes orhours to install and configure.