Hello guys, I have a problem with unwanted <br /> and p-tags in the shortcode output only if it comes from an ACF field and output code, for example in the shortcodes from Wpforo (forum) or Ultimate Member used in an ACF WYSIWYG field.
Once I solved that, but unfortunately forgot how and cant find it. It had nothing to do with wpautop or anything like that. I don’t want cut them out, i want prevent them.
Can someone help me and has the solution ready? I’ve googled myself sore! I am very happy …Thanks a lot
I just did a quick test of a shortcode in both classic editor and an acf WYSIWYG editor. This shortcode simply outputs simple text. The output is the same in both cases with no added whites space elements added to the text.
Exactly what/how are you adding with the shortcode?
Hello John, thanks for your answer.
I have no problems with my own shortcodes or shortcodes in general, but only if the shortcode comes from a plugin and outputs a code template will I get these unwanted line breaks. For example with Ulitmate Member Plugin, WPForo or finally I tried to use the email download link plugin (https://de.wordpress.org/plugins/email-download-link/).
My template is entirely based on ACF. All fields of my template are saved in an array. Instead of the expression “the_field (‘prefixed_field_name’)” I use “echo $ field_output (‘field_name’)”, because I remove the prefix beforehand.
I’ve tried this with other plugins that add shortcodes and I’m not seeing any issue. The plugins you mentioned would be too involved to me to set up and test on one of my test sites and your setup seems complex.
Can you give me an example of shortcodes in a WYSYWIG that is producing the extra white space?
Viewing 6 posts - 1 through 6 (of 6 total)
The topic ‘Acf is adding line breaks an paragraphs in Shortcode output code’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users