I used the plug-in 'Disable XML-RPC' rather than edit any code.

Though I was surprised to receive an email from Wordfence Security saying that they are not disable XML-RPC on their own sites due to the loss of API calls.

It all comes down to how you use your own WordPress installation I guess. But I'd rather be safe than sorry.