I have created a custom shortcode [colored-list] to simply print an HTML code template. The reason to build this shortcode is because I am using PHP loop in it to print the list of text in different color sets based on the item count. So e.g. first text will be red, second blue, third yellow, fourth again red,…blue, yellow. So this is how I have built a color cycle for every text.

I have created lot more shortcodes for different purposes but above one is just for example.

Now what I am doing is, I have created a WYSIWYG editor using Advanced Custom Field plugin to add some more content. And I am using this shortcode in it. But every time I echo it on frontend, it prints with P tags added to so many places.

I have tried so many fixes like removing wpautop filter, applying “the_content” filter etc. But none of them helped.

Read more here: Problem with using custom shortcode with ACF WYSIWYG field


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: