I have a custom theme where when I upload an image with caption, the caption shortcode is shown on the page: [caption id="attachment_109"]...
. Using either of WP's default themes, I see no issue. On inspection, WP uses the_content()
, link, so I need to do some stripping. I get my posts with get_page_by_path()
:
<?php
$post = get_page_by_path( $current_page->post_name, OBJECT, 'service' );
// I assume this would work
$content = the_content($post->post_content);
//Blank page:
echo $content;
Echoing $post->post_content
shows the caption shortcode as mentioned above. How to get rid of if it? BTW, I need the caption values.