Overwrite validation for creation of wordpress posts via rest api

I just ran into a problem with my wordpress side:

I want to build a javascript app where you can create posts from. It should be seperated from the WordPress backend and communicate only via the REST API. So far so good. Everything is connecting successfully and I can create a post.

The problem comes with the tags. I want to give the user the possibility to just type in all the tags he wants, comma seperated and then send them to wordpress with the post. The problem is: I get a comma seperated list of tags, of which some are already in wordpress, some are not. But I can’t just send them to wordpress because it accepts only an array of integers.

So the question: Is there another solution, than

  1. Get all available tags
  2. Check which ones of the entered tags are already in wordpress
  3. Create all the others
  4. Build an array from the Ideas and send it with the article

Because this process would just take too long if the user doesn’t have anything to do in the mean time and will eventually just close the window before it is done.

My preferred way would be to just send the comma-seperated string or an array of slugs to the backend and create the missing tags.

Is there a way to do that?
Thanks in advance 🙂

Read more here: Overwrite validation for creation of wordpress posts via rest api

Leave a Reply

Your email address will not be published. Required fields are marked *