Code Canal is the simple Web resource site for WordPress, Magento and other CMS and frameworks, with easy to understand technologies and provides easy tutorials for the creating and editing site.

Our Latest Tutorials Guide for WordPress :

Sometimes empty tags occurs issues in design. So we need to remove empty p tags from custom shortcode in WordPress. Herer we will see how to remove theme.

Put the following code in function.php file. function.php file is located in root directory of the active theme folder.

add_filter("the_content", "remove_p_content_filter");

function remove_p_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;


Now the empty tags will be removed from the shortcodes. Enjoy the coding. 🙂

While validating the W3C, we need to remove "type" attribute from script and style which were added by WordPress.

The style_loader_tag and script_loader_tag approaches above look like they should work for whatever markup Wordpress is generating, in cases where the theme/plugin is using the proper enqueue functions.

If you have offending plugins that don't cooperate (IIRC Jetpack is/was an offender unless a newer version since my recollection has revised this!), and you are adamant about solving this issue despite the fact that your visitors are not likely to be impacted in any way (their browser will render the page fine!), you can

Category: Tutorials
Comments: 0

Deferring parsing of JavaScript is one of those messages that you get on sites like GTmetrix and other page speed sites that may sound like it’s from another planet. What on Earth does defer parsing of JavaScript even mean? Basically, what the message is saying is that a browser needs to process all of the content inside tags before it can load the page. By putting off the processing of JavaScript until it is actually needed, you can reduce the initial load time of your page.

There are a few reasons why we should defer parsing of JavaScript in WordPress. The most important one is speed and performance. Generally, JavaScript is placed between the head tags. When opening a website, it loads the code from top to bottom. This means that if you have lots of JS or long strings, it will take more time for the website’s content to appear, as it first waits for all the JavaScript to load.

Page 1 of 8 123478