Pexel API

I am facing a problem whereby my post is very dull and do not have a featured image. What if I could automate the featured image creation?

So I decided to look for options.

  1. DeepAI
    It generates weird images
  2. OpenAI DALL-E
    I have no idea where is the API. I might ask around soon
  3. APIs
    There’s a couple but the photos are taken from Unsplash or Pexels

So why not just go to the direct source instead?

Unsplash – It has a troublesome review period 5-10 days

Pexel – It seems like it’s easier to do with pexel.

The documentation is quite straightforward:

However, for my use, I will need to convert to PHP codes.

But before that, let’s test on Postma

1) Create a new collection, call it Pexel.

2) Save Request – Name it as Search Image

3) It works! You need to enter your API key in the Authorization tab.

Now all i need to do is convert to PHP.

A simple php code outputs

It just basically means it works. Now it is time to convert this to WordPress plugin or snippet.

And done!