We recently rolled out a really awesome feature set for advanced WordPress Users.  If you’re a WordPress badass, you are probably going to love this new tool.

Inside the WP Engine admin screen, scroll to the bottom and you’ll see the “Advanced Configuration” section.  We’re going to be adding more tools here, but for now we’ll focus on the HTML Regex Replacements Tool.  This first advanced config feature is a very precise “search and replace” tool that gives you the power to change the HTML that WP creates.  The tool will behave similarly to preg_replace().

WordPress Advanced Configuration HTML Regex Replacement tool

Example: The following example removes all HTML comments in the first pattern, and causes a favicon (with any filename extension) to be loaded from another domain in the second pattern.

#<!--.*?-->#s =>
#bsrc="/(favicon..*)"# => src="http://mycdn.somewhere.com/$1"

You can specify any number of regular expressions to match HTML content and the replacement value.  The replacement can also include grouping replacements.

Among other things, this allows you to:

  1. Add support for the CDN where our normal CDN patterns don’t find it, by matching the paths in question and inserting the correct CDN URL in front of them.
  2. Remove bad code, like if they’re including jQuery in the footer as well as the header and with the wrong version.
  3. Change a wrong url, by finding it and replacing with the right one.
  4. Add optimizations like replacing a WordPress jQuery URL with the Google hosting one.

Like I mentioned, the replacement tool is essentially a search and replace tool, but it works at a very tactical level.  Stating the obvious, playing with your code this tactically can get complicated.  This feature is not for everyone to jump into right away.  If you’re a badass, go for it.  If not, just coordinate with support.  They’ll take care of you.  And remember, you can create a restore point before you start making changes.  So if things get buggy, you can just ctrl + z your WordPress back to the way it was.

We will continue adding advanced features to this section, making it possible for technical consultants (as well as our tech support) to do all sorts of useful things without resorting to special “tech support tools” or configuration files.

Oh, and while I’m on the subject….is there a feature you’d like to see added here?  If you’re one of the consultants who has thought “wow, I wish that they would build a tool that…..” please tell us.  If it’s a useful tool for lots of WP Engine customers, we may be able to build it!