Is there a way to periodically generate pages/posts in wordpress backend using javascript ajax function?

What i need to do:

  • Loop trough an array
  • for each value in the array do an ajax call
  • create a page if there is a result OR delete a page if there is no result

Here is some JavaScript i managed to write as an reference what i need:

const cities = [berlin, barcelona, london, paris, monaco, rome]
cities.forEach(function(city) {
        url: "",
        type: "POST",
        data: { action: 'city_search_form', city: city },
        success: function(result) {
            if (!result.includes("Text placeholder")) {
            // create a page with the array value "city" as the title


I need this to be done once a day.

I can't seem to find an answer if this is even possible

Read more here:

Content Attribution

This content was originally published by KastleJ at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: