How to Return in WordPress Function php file?

The code is:

function my_custom_function( $html, $content ) {

$html .=  get_post_field('post_content', $post_id);

return $html;
}

$priority = 10;

add_filter( 'tps_the_content_after', 'my_custom_function', $priority, 2 );

If my content is “this is my content”, then the code return “this is my content”

I want to add <div> before the content, but I don’t know how to write the code, it should return like this

"<div class="post">this is my content</div>"
Thank you!



Source link