Connect with us

Solved – WordPress short code not working with post_content


Solved – WordPress short code not working with post_content

I am continuously working with WordPress since last few years. In one of my project, my client was facing a problem with short code. My Client uploads an image and add Caption. Caption is added and it looks fine with WP Editor. But when he view that page in front end, it shows short code itself instead of real converted short code html. I searched for the same and found that short code works with the_content or get_the_content. I used $post->post_content for custom post type. This means WordPress Short code not working with post_content.

To solve this and convert short codes, you just need to write below code. You need to use the_content() function which convert short codes automatically.

if( have_posts() ) {
  while (have_posts()) : the_post();

If you are unable to write such code and wanted to convert short codes, than you can also use below function.

<?php do_shortcode('[shortcode_here]');?>
For e.g.
<?php do_shortcode('[contact-form-7 404 "Not Found"]');?>

Using this function, you can convert short code manually. Let me know if you are facing any problem with this.

Related:  Don’t Let Your WordPress Site Go Post-Apocalyptic: Lessons to Learn From Fallout 4
Continue Reading
You may also like...

We are a WordPress plugin developer company that focuses on useful WordPress plugin creation and empowering people to earn passive incomes from their blogs. We build unique and groundbreaking plugins that will revolutionize your blog!

Click to comment

Leave a Reply

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

More in coding

Sign up for our newsletter and get a free affiliate e-book!

About Me:

Szabi Kisded

Hi, my name is Szabi and I'm documenting my journey earning an online (semi)passive income. Learn more

Mega Plugin Bundle:

CodeCanyon Portfolio:

Online Courses:

Recommended Theme:

Popular Posts:

Latest Posts:

To Top