Shortcode not displaying in correct location

To display the Wordpres Shortcode  return value in correct location, we need to use the “ob_start()” and  “ob_get_clean()” as like below.

<?php
function your_shortcode_fun( $atts ){
ob_start();
?> <HTML> <here> ... <?php
return ob_get_clean();
}
add_shortcode( 'your_shortcode_name', 'your_shortcode_fun' );
?>

It will place the output in correct location.

Leave a Reply

Your email address will not be published. Required fields are marked *