How to add content at the end of posts?
You can simply use get_field that returns the field instead of the_field that echo it. function custom_content_filter_the_content( $content ) { if ( function_exists(‘get_field’) ) { $content .= ‘<span class=”custom_fds”>’ . get_field(‘field1’) . ‘</span>’; } return $content; } add_filter( ‘the_content’, ‘custom_content_filter_the_content’ );