Acceptance Testing in WordPress Plugins

Acceptance tests allow us to check that all functionality within our plugin works as it should without the need for a manual process. This may take a little time to first get into place but being able to run a couple of commands and leave the tests running is an amazing time saver.

Read More

Avoiding Timeouts With Ajax

When developing plugins for WordPress I've recently hit a couple of occasions where there was a need to update all posts of a certain type (in my case WooCommerce products). On my local machine, even with a lot of products generated (5000+), I hadn't hit any timeout issues so it never occurred to me that this would become a problem. But before too long I had customers attempting the same processes and running into issues (due to either server setup, size of database or other extension or similar).

Read More

Translating a WordPress Plugin

To add translations and ensure nothing gets overwritten on a plugin update WordPress now provides us with an easy method. Within the wp-content folder one can now add a plugins and/or themes directory, if they don’t already exist. These folders will contain the completed translations for any plugins/themes required and they will not be altered when the extensions are updated.

Read More

Developing Locally with WordPress using PHPStorm and Local by FlyWheel

I recently switched from VVV ( Varying Vagrant Vagrants) to Local by FlyWheel (formerly Pressmatic). I loved VVV but without prior knowledge of any of it’s inner workings it was a rather steep learning curve that caused plenty of frustration when things didn’t work as expected. This usually resulted in a fresh install of VVV rather than ever finding where I had messed up. Enter Local.

Read More

Git Branching

When working on a project it’s handy to leave the master branch in your repository as your “working copy”. Whenever a change needs to be made you can create a branch, mess about with the code in any way necessary, thoroughly test it and then merge that code into the master branch when you’re happy it all works.

Read More

Using AJAX on the WordPress Frontend

There are a few helpful things to bear in mind when using ajax on the frontend:

  • Actions must be hooked up before the ‘wp’ hook (I usually run them on ‘init’)
  • The ajaxurl javascript global may not be defined and so you need to do this yourself
  • There are two hooks to use for the ajax call
Read More