I created a plugin that adds content from another post, and places this content next to the original content. I can say, that this content should appear at the bottom of the original post content.
I get post_content
for my additional post, and then call apply_filter('the_content', $custom)
but this code does this not only for my $custom
, but for original content as well! What am I doing wrong?
add_filter( 'the_content', 'custom_content' );
function custom_content( $content ) {
$customPost = get_post( 22 );
remove_filter( 'the_content', 'custom_content' );
$html = $customPost->post_content;
$html = apply_filters( 'the_content', $html );
return $content . $html;
}