The Definitive Guide to Setting Up WordPress in 2024: A Bristol Freelance Web Developer’s Essential Setup
In the ever-evolving landscape of website development, staying ahead of the curve...
A quick way to remove empty p tags from custom shortcodes in WordPress.
<?php
add_filter("the_content", "the_content_filter");
function the_content_filter($content) {
$block = join("|",array("shortcode1","shortcode2","shortcode3"));
$rep = preg_replace("/( <p> )?\[( $block )(\s[^\]]+)?\](<\/p>|<br \/>)?/", "[$2$3]", $content);
$rep = preg_replace("/( <p> )?\[\/( $block )](<\/p>|<br \/>)?/","[/$2]",$rep);
return $rep;
}
Credit: https://gist.github.com/bitfade
PHP, Wordpress Function, WordPress Tips
Share
In the ever-evolving landscape of website development, staying ahead of the curve...
In the digital realm, your website serves as the cornerstone of your...
In the ever-evolving world of e-commerce, having a robust and flexible platform...
In today's digital age, having a strong online presence is crucial for businesses. When it comes to building a website,...
Is your HTML5 Video playing perfectly on Android phones, but not on iPhones? If you are having problems with your...
This is the best method I found for completely removing the comments from WordPress. This combination of functions will remove...