Generate any Google API Key to Integrate with WordPress

Google application programming interfaces (APIs) are developed by Google to allow developers to integrate services such as Google Maps, Translate and Google Search into their websites. When using WordPress, it is as easy as inserting a Google API key into the theme settings to access a Google Service.

However, the process to acquire a Google API key may be tedious and confusing on your first attempt. In this step by step tutorial, you will learn how to generate any Google API key easily, and let’s take for example Google cloud translation API.

Note: It is recommended to bookmark this article because you may need it when integrating several Google Services into your WordPress websites.

1. Go to https://console.cloud.google.com/ and sign in using your Gmail credentials. Hit the drop-down arrow then ‘New Project’ as shown below:

2. Name your project then hit ‘Create’. For this example, we are creating a project to access the translate google service.

3. You now need to search for the API you want. In this tutorial, we want the Cloud Translation API. Click on the result you need as shown below:

4. Enable the API as shown below:

5. You now need to create credentials for your new API by clicking on ‘Create Credentials’ as shown in the image below:

6. You now need to select the API you are using then choose the first option (Yes, I’m using one or both). Hit ‘What credentials do I need?’ to proceed.

7. Hit ‘Done’ as shown below:

8. Select ‘API key’ as shown in the illustration below:

9. You have successfully created an API key! You now need to restrict your API key.

10. Under ‘Application restrictions’ select ‘HTTP referrers’ then add your website URL as shown below.

11. Under ‘API restrictions’ select the API in use then hit save to save all the changes.

Conclusion: You now know how to generate a Google API key to integrate with WordPress themes or plugins. You should note that you need a paid account to create an API key. However, when you set up a paid account, you get $300 free credit to start you off!