I am developing my first wordpress theme. I encountered a problem in page section. I added a image in a page with add media button. When i viewed the page, it does display the image but also the caption part.

 [caption id="attachment_50" align="alignnone" width="300"] (actual image) [/caption]

I can't figure out why it's showing up. I googled a lot but couldn't find a solution. Please help me out.

  • Are you outputting content via the_content()? That's the built in Caption Shortcode. – Milo Jun 7 '14 at 14:50
  • Try switching to a default theme and see if the problem persists. If it does, try disabling plugins one by one and checking again. This is a popular technique for ruling out any troublemakers before we have to look further. – TheDeadMedic Jun 7 '14 at 14:51
  • @Milo I am using get_page_by_title() function and assigning it to a variable. Then getting the content like $page = get_page_by_title('About'); $page->post_content – IamGhale Jun 7 '14 at 14:54
  • @TheDearMedic It's working fine in default theme. – IamGhale Jun 7 '14 at 14:55
  • I found the solution here. I used apply_filters('the_content',$post->post_content) which stores it's html formatting. – IamGhale Jun 7 '14 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.