Well, esc_html()
doesn’t echo/display the return value (escaped string), so you need to call echo
manually:
echo esc_html( $FileContents );
Update
If you actually want to filter the list of allowed HTML tags in the variable’s value, then you can use the WordPress’ KSES functions like wp_kses_post()
and wp_kses_data()
:
echo wp_kses_post( $FileContents );
echo wp_kses_data( $FileContents ); // allows basic HTML by default