Using Output Buffer in Shortcode

If you’re using a shortcode to display a customize content with lots of HTML tags output buffering is your tool. It’s a common Issue when using a shortcode is we echo it’sĀ output, in return the output doesn’t follow the layout of the builder.

function display_me_properly_callback(){
  <p>This is a test.</p>
  return ob_get_clean();

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.