Unable to use html code in API parameters

Hey, this is Mahmudul,
I am trying to publish content using WordPress API so I am trying to use WordPress blocks to achieve my content style but I am unable to use HTML code in API parameters, it just worked for normal text.

here is the code I am trying to pass

`

<div class="wp-block-columns">
  <div class="wp-block-column" style="flex-basis:50%">
    <p>This is the content of the first column.</p>
  </div>
  <div class="wp-block-column" style="flex-basis:50%">
    <p>This is the content of the second column.</p>
  </div>
</div>

`

and i am getting the following errors

You need to URL Encode your content, then when you read it, URL Decode the content.

Methods:

decodeURIComponent(string)
encodeURIComponent(string)

This is something that should be available as a plugin as well.

1 Like

Thanks for your help, could you please share more i am a beginner i don’t how to encode url. how to achieve it?

Sure! Give me about 20 mins and I’ll show you da way :wink:

1 Like

Thanks, i am wating…

1 Like

Sorry for the wait, had to debug a few things and make this easy for anyone else to use as well.

So. I have updated my BubbleEssentials plugin to incorporate that functionality. There is two actions:

[GC] Encode URI Data
[GC] Decode URI Data

In my demo & editor it shows how to use them. If you have questions, let me know.

Thanks for your reply, but I am not sure how to use it, I am trying to get an HTML response from ChatGPT now my work is posting on a WordPress website using API but the problem I can’t pass the parameters in the form of HTML now If I encode the HTML response using Bubble Essentials and pass the parameter to WordPress it will post encoded data, So how could i handle this?

You have to decode it after you encode it and pass as a string. When you receive it, DECODE it, then use it.

This topic was automatically closed after 70 days. New replies are no longer allowed.