Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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?

like image 533
Midhun Avatar asked Jun 10 '15 08:06

Midhun


People also ask

What is the X-frame-options header?

The X-Frame-Options HTTP response header can be used to indicate whether or not a browser should be allowed to render a page in a <frame> , <iframe> , <embed> or <object> . Sites can use this to avoid click-jacking attacks, by ensuring that their content is not embedded into other sites.

How do I add Hsts header in WordPress?

Just drop the following code into your theme's functions. php file and you will have enabled HTTP Strict Transport Security (HSTS) to your WordPress site. * Enables the HTTP Strict Transport Security (HSTS) header in WordPress. add_action( 'send_headers' , 'tg_enable_strict_transport_security_hsts_header_wordpress' );


1 Answers

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 );

like image 69
Artem Russakovskii Avatar answered Sep 29 '22 06:09

Artem Russakovskii