How to set X-Frame-Options Header in wordpress Site

Midhun picture Midhun · Jun 10, 2015 · Viewed 44.9k times · Source

I have hosted a website which is created using Wordpress.

I am getting a security alert saying "X-Frame-Options Header Not Set", but I can't figure out what that means.

Can anyone explain what this warning is about, and give me a solution on how to stop it from occuring?

Answer

Artem Russakovskii picture Artem Russakovskii · Jun 15, 2017

Here's an easier one-liner to set X-Frame-Options SAMEORIGIN that works, add the following to the functions.php file in your current Wordpress theme:

add_action( 'send_headers', 'send_frame_options_header', 10, 0 );