0 0 votes
Article Rating
wordpress,shortcode,wrong place
shortcode

add_shortcode('custom_shortcode', 'custom_function');

function custom_function() {

        ob_start();

        codes…..;

        $content= ob_get_clean();

        return $content;

}

The reason why we use ob_start() and ob_get_clean() is to buffer the output.


Chris

Chris

Just me, need more info?

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x