Building the Perfect Bootstrapped Business on WordPress

Building the Perfect Bootstrapped Business on WordPress. Inspiring talk on so many levels. Where to find recurring value: business cycles; ongoing, value-generating costs; highly dynamic environments.

Add a rel=”nofollow” checkbox to WordPress link modal

With a little bit of JavaScript, you can add a rel="nofollow" checkbox to WordPress’ link editor, right below “Open link in a new tab”.

Customizing the WordPress link modal requires using JavaScript to first modify the form’s HTML, then overriding functions on the wpLink object to perform additional behavior.

Use Jetpack’s Photon image resizing in local development

In order to dynamically resize an image, Photon needs to be able to fetch the image file over HTTP. Jetpack disables Photon when JETPACK_DEV_DEBUG is defined because the assumption is that your local development domain isn’t accessible from the public internet. But, if you configure Photon in your local environment, you can tell Jetpack to enable all of Photon’s features too.

Setup Photon

First, check out the Photon codebase to a location served by your VIP Quickstart or Salty WordPress Vagrant:

svn co https://code.svn.wordpress.org/photon/ photon.dev

You’ll need to set up a record within your web server (Nginx or Apache) to serve the domain. If you aren’t using dnsmasq for local development, you’ll need to edit /etc/hosts on your local machine too.

Install Gmagick

You probably don’t have Gmagick installed, which Photon uses to resize images, so you’ll need to install it. For me, this was:

apt-get install php5.6-gmagick
service php5.6-fpm restart

Add a couple of filters

The last step is to add a couple of filters to a local mu-plugin or similar:

add_action( 'jetpack_modules_loaded', function(){
include( Jetpack::get_module_path( 'photon' ) );
add_filter( 'jetpack_photon_development_mode', '__return_false' );
}, 11 );

add_filter( 'jetpack_photon_domain', function( $domain ){
return 'http://photon.dev';
});

WP LCache v0.5.0: The big alloptions breakup

Happy to announce the latest and greatest of WP LCache, [v0.5.0](https://github.com/lcache/wp-lcache/releases/tag/v0.5.0).

This release focuses predominantly on splitting WordPress’ alloptions cache into separate cache keys to mitigate cache pollution caused by race conditions. [Read #31245](https://core.trac.wordpress.org/ticket/31245) for all of the gory details. Thanks to [Ryan](https://twitter.com/rmccue) and [Joe](https://twitter.com/joe_hoyle) for paving the way.

If you haven’t thought about WP LCache since the [v0.1.0 announcement](https://handbuilt.co/2016/09/08/introducing-wp-lcache-v0-1-0/), you’re missing out. WP LCache is faster than other object cache implementations because:

* By using APCu, which is in-memory, WP LCache uses the fastest possible persistent object cache backend and avoids costly network connections on every request. When using a Memcached or Redis-based persistent object cache where Memcached or Redis is on a different machine, the millisecond cost of each cache hit can add up to seconds of network transactions on every request.
* By incorporating a common L2 cache, WP LCache synchronizes cache data between multiple web nodes. Cache updates or deletes on one node are then applied to all other nodes. Without this synchronization behavior, APCu can’t be used in server configurations with multiple web nodes because the cache pool is local to the machine.

Still not convinced? WP LCache has a variety of features no one else has, including native handling of cache groups, meaning you can delete an entire group of keys with `wp_cache_delete_group( $group );`.

Props again to [David Strauss](https://twitter.com/davidstrauss) for his ongoing work on the LCache library, and to [Pantheon](https://pantheon.io/) for sponsoring open source infrastructure.

Install, activate and enable with `wp plugin install –activate wp-lcache && wp lcache enable`.

Questions to ask when determining why a WordPress site is going down

Working on a WordPress site that’s crashing all of the time? Here are some qualifying questions you can use to determine why it might be going down:

  • When does the site go down? Is it a particular time of day that could be correlated to traffic patterns?
  • When the site goes down, what do you do to bring it back up?
  • When did the problem start happening? Is it closely related to some other change that was made to the site?
  • What have you done in previous attempts to fix the problem?
  • How are the servers configured (RAM, etc.)? Does adding more capacity remediate the problem?
  • What caching plugins are you using? Do you have other caching strategies in place (e.g. Varnish or Cloudflare)?
  • What plugins are you running? How customized is your theme?

Importantly, these qualifying questions should give you better visibility into the nature of the problem, to help guide further debugging.

Introducing WP LCache v0.1.0

[WP LCache](https://wordpress.org/plugins/wp-lcache/) is a new persistent object cache drop-in for WordPress that I’ve been working on with the folks at [Pantheon](https://pantheon.io/).

“But why another object cache drop-in?” you might ask. Because it’s faster than [the others](https://handbuilt.co/2016/04/26/a-persistent-object-cache-is-not-a-panacea/), of course.

Under the hood, WP LCache uses [LCache](https://github.com/lcache/lcache), a library that applies the tiered caching model of multi-core processors (with local L1 and central L2 caches) to web applications. In this particular configuration, APCu is the L1 cache and the database is the L2 cache.

APCu is the fastest persistent cache backend you can use, because it exists in PHP memory. However, APCu traditionally can’t be used on multiple web nodes because each node represents a different cache pool. Because WP LCache has a database-based L2 cache, a cache update or delete on one node is then automatically synchronized to all other nodes.

Props to [David Strauss](https://twitter.com/davidstrauss) for his hard work on the LCache library. Thanks to [Steve Persch](https://twitter.com/stevector) and [Josh Koenig](https://twitter.com/outlandishjosh) for their help with the WordPress implementation.

Feeling adventurous? Install WP LCache from [WordPress.org](https://wordpress.org/plugins/wp-lcache/) or [Github](https://github.com/lcache/wp-lcache), and [send us feature requests (or bug reports)](https://github.com/lcache/wp-lcache/issues).