07-27-2023, 10:04 AM
I have a WordPress powered website that on the homepage uses a static page with nothing but shortcodes to generate the content.
The page gets these shortcodes by setting the front page to a static page and using the_content(); on page.php. The page content has no spaces, only shortcodes, so looks something like this:
[content-shortcode blah blah][more content-shortcode blah blah]
It all works fine, except that WordPress adds an empty `<p></p>` before the shortcodes code and another P /P at the end of all the shortcodes code (Nothing in between shortcodes).
How can I remove them? I do not want to disable the global wpautop removal function though, as it can be useful for some users, I only want to remove the first and last P's that appear on the homepage.
The page gets these shortcodes by setting the front page to a static page and using the_content(); on page.php. The page content has no spaces, only shortcodes, so looks something like this:
[content-shortcode blah blah][more content-shortcode blah blah]
It all works fine, except that WordPress adds an empty `<p></p>` before the shortcodes code and another P /P at the end of all the shortcodes code (Nothing in between shortcodes).
How can I remove them? I do not want to disable the global wpautop removal function though, as it can be useful for some users, I only want to remove the first and last P's that appear on the homepage.