I’m creating an accordion inside Boldgrid column, using the Boldgrid Post and Page Builder. Per suggestions elsewhere in this support, I’m doing it using the Collapse-O-Matic plugin, which works by using a shortcode entitled [expand][/expand], and I’m editing the code inside of the text view. WHen I click “Update”, Boldgrid inserts, after every entry, an additional paragraph — <p> </p> —- and also surround each accordion item with paragraph breaks. If I delete them in the text editor, they re-appear. If I delete them in the visual editor, they reappear. This is really messing up the appearance of this accordion. Can you help?
This behavior is known as “wpautop,” a function WordPress has built-in to make sure that all of your HTML is “valid.” There are plugins out there like Toggle wpautop that fix this problem for the front end of the website, but the only way I know how to fix it when switching back and forth between the visual editor and the text editor is with a custom PHP snippet.
I took a couple minutes to record this short video of how to accomplish this for you:
In brief, you’ll need to install the Code Snippets plugin and add a new snippet with this code: