What it is

It’s a live search modal window in the WordPress admin! Using it to search admin content will return results for WordPress Admin Menu items, as well as links to the Edit Screen for user-generated content. We also included some keyboard shortcuts to make WordPress Admin Actions faster.

Why it is

Using the ACP is a more efficient way to get from one place to another. In the WordPress admin, if you want to go from editing one post to another post, you’ve got to click back to the posts screen, find the post you want to edit, and click on it. With the ACP, we can cut 2 page loads down to one. It might not seem like much at first, but spend a whole day working on content entry and you’ll thank your lucky stars you’ve got something like this up your sleeve.

There are many similar plugins to ACP, but what makes ours better is:

  • Support for searching user-generated content.
  • Searching with pre-assembled data vs.  AJAX keeps the search faster.
  • We include Admin Actions and keyboard shortcuts that make interacting with buttons and links in the WordPress Admin much faster.
  • The appearance of the search modal matches the rest of the WordPress admin for seamless user experience.

How it is

Here’s the part where I tell you a bit about what makes this plugin tick, and how we came to build it. Three CNP devs (Glenn Welser, Sam Mello, and myself) have been working on this project since I got the idea for it two months ago.

After the idea hit me, I wrote up a plugin proposal to document why I thought it would be useful, and to demonstrate how it would work. I ran it by my fellow devs, and then presented the idea to Alex Nikdel and Jarrett Smith, who gave us the green-light.

screenshot-1

We split up development into three parts: Javascript (Glenn), PHP (Sam, mostly), and HTML/CSS (me). We began by working on the data sources: Admin Pages (which is built by accessing the $menu and $submenu WordPress global variables), Admin Actions (a handpicked list of actions, each with a custom keyboard shortcut), and User-Generated Content (a potentially hefty SQL statement that retrieves data from the wp_posts table). It assembles and caches that data with PHP and a handy user-scoped WordPress transient. The data is then loaded into the WordPress admin via AJAX. The live search itself uses the Fuse.js library to filter the data array, and return matching results.

We ran in to a few hurdles while building the plugin. At first, we were loading the combined search data into the DOM, but it ended up significantly hurting page load time on sites with 10k+ entries in the wp_posts table. So we decided to load the search data in via AJAX instead and created a Settings Page so that users have complete control over which post types are included in the search data.

screenshot-2

Another issue came up when we were trying to cache the data effectively: we found that Admin Pages were only added to the search data when the cache is active, because the $menu and $submenu WordPress global variables were not accessible at the time that the data is initially loaded in via AJAX.

One of the hardest things to do was to name the plugin. We took a couple hours shopping ideas and thoughts around to many of the creative minds here at our agency. I must’ve written down 40 different ideas, and the name changed 3 times before we came back to our original: the Admin Command Palette.

This plugin isn’t just a search modal: you can not only navigate the WordPress admin faster, but also interact with the WordPress admin faster. And it’s only going to get better from here.

At the time of initial release, we had spent around 60 hours working on it. We managed our time for the project by taking a few nights to stay late, eat some pizza, and work on the plugin.

Where It’s Headed From Here

We initially made the decision to pre-assemble the data in order to keep the search fast. While that makes sense for Admin Pages & Actions, which are fairly limited, things can get a bit crazy once user-generated content is factored in. The first dev site I tried loading it on ran out of memory trying to compile the user-generated content data, but that was due to a post type that stored every inbound message in the database (5,360 messages and counting).

Now, we can mitigate that issue by excluding specific post types in the ACP settings, but big sites need this plugin more than anybody. I think in our next release we’ll look to refactor the user-generated content portion of the search into an AJAX call. It’s possible we could create a new setting for search mode: pre-loaded or AJAX. We’ll also be looking into compressing the size of the data array, and adding new settings so that users can configure their own keyboard shortcuts.

I think I’d also like to explore the idea of more complex Admin Actions– right now, every admin action merely triggers a click of a DOM element. It would be interesting if we could run the Clear Cache action directly from the ACP, which would save users the trouble of navigating to the ACP Settings Page.

How Users Can Help

When we came up with the idea for this plugin, I wrote up a Plugin Proposal and pitched it to my colleagues, and then to the WordPress community via Slack and the WordPress Ideas Page. The feedback was negligible: nobody responded to me on Slack, and only a couple people responded on the WordPress Ideas page. I would guess that it’s easier to give feedback when you’re looking at a real thing versus trying to conceptualize an idea, but we have those avenues for that purpose. For our next plugin, I think I’ll try pushing the proposal harder, so we can get some more feedback on it before we get going.

That said, if you experience an issue with ACP, or an idea for how we could make it better, let us know! You can send us feedback on the WordPress.org plugin support forum, or by opening an issue on the plugin’s Github repo.