Back to Top

Solution: Shortcode move to top of content issue

Solution: Shortcode move to top of content issue

Recently I was working with one of application and I have created shortcode for some functionality and I want to display shortcode data after the content of posts so I have place shortcode after the post content from admin editor.

But in frontend, shortcode data was displaying in top of content even I put shortcode anywhere in editor, It displays top of page so today I am going to share how I solve issue of it

You should check out this ShortCode in WordPress to learn everything about Shortcode in WordPress with examples

I have used ob_start and ob_get_clean function to clear the buffer and it starts working. That will return the content rather than echo it directly and that you have to do in the case of a WordPress shortcode

Solution

This works for me like a charm. Hopefully works for you also. Please share this article if this works for you.Solution: Shortcode moves to the top of the content issue.

You may also like:

Programmatically Insert Content in WordPress
SSL with WordPress
Create Own Widget in WordPress

Leave a Reply

Your email address will not be published.

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

Most Popular Posts

PHP 7 new Features at a Glance

Posted on 8 years ago

Bhumi