Title: SameSite Cookies
Author: Ayesh Karunaratne
Published: <strong>2019-يىلى 2-ماي</strong>
Last modified: 2023-يىلى 23-ئىيۇل

---

قىستۇرما ئىزدە

![](https://ps.w.org/samesite/assets/banner-772x250.jpg?rev=2155223)

This plugin **hasn’t been tested with the latest 3 major releases of WordPress**.
It may no longer be maintained or supported and may have compatibility issues when
used with more recent versions of WordPress.

![](https://ps.w.org/samesite/assets/icon-256x256.jpg?rev=2155223)

# SameSite Cookies

 يازغۇچى [Ayesh Karunaratne](https://profiles.wordpress.org/ayeshrajans/)

[چۈشۈر](https://downloads.wordpress.org/plugin/samesite.2.1.zip)

 * [تەپسىلاتلار](https://ug.wordpress.org/plugins/samesite/#description)
 * [باھالاشلار](https://ug.wordpress.org/plugins/samesite/#reviews)
 *  [ئورنىتىش](https://ug.wordpress.org/plugins/samesite/#installation)
 * [ئىجادىيەت](https://ug.wordpress.org/plugins/samesite/#developers)

 [قوللاش](https://wordpress.org/support/plugin/samesite/)

## چۈشەندۈرۈش

This plugin adds the «SameSite» cookie flag to WordPress’s authentication cookies.
On supported browsers (all current IE, Edge, Chrome, and Firefox), this can effectively
prevent all Cross-Site Request Forgery attacks throughout your WordPress site.

SameSite cookie flag support was added to PHP on version 7.3, but this plugin ships
with a workaround to **support all PHP versions** WordPress supports.

There is no administrative UI provided: Activate this plugin, and you are all set!

You can configure the SameSite flag value from your WordPress configuration file.
You cna pick a value from `Lax` (default), `Strict`, or `None`. You can read about
[SameSite cookies here](https://php.watch/articles/PHP-Samesite-cookies).

To configure the `SameSite` flag value, edit your WordPress configuration file (`
wp-config.php`), and add the following lines right above `/** Sets up WordPress 
vars and included files. */`.

    ```
    define( 'WP_SAMESITE_COOKIE', 'Lax' ); // Pick from 'Lax', 'Strict', or 'None'.
    ```

Note that **only the authentication cookies are affected**. Regular cookies that
your installed plugins set will **not** be affected, nor provide any meaningful 
value with `SameSite` flags.

## ئېكران كەسمىسى

[⌊Browser response containing the SameSite attribute in Setcookie headers.⌉⌊Browser
response containing the SameSite attribute in Setcookie headers.⌉[

Browser response containing the SameSite attribute in Setcookie headers.

## ئورنىتىش

 1. Install this plugin as you would with any other plugin.
 2. Enable it.
 3. There is no third step – From this point afterward, authentication cookies your
    WordPress site uses will contain SameSite flag, and you will be protected from 
    CSRF attacks.

If you find this plugin useful, I’d appreciate you leaving a review on the plugin
page.

## FAQ

### The plugin doesn’t work !?!?

Yeah, probably. This plugin uses what’s called «pluggable functions» supported in
WordPress to replace `wp_set_auth_cookie` function.
 This means that any other plugin
that tampers with the login cookie parameters will override this plugin, and this
plugin may not even get a chance to do what it does.

### How do I test if the plugin works

Go to the Login page of your WordPress site, and open your browser’s development
tools. Inspect the HTTP POST request made by the browser when you submit the login
form. The response headers for `Setcookie` response headers must contain `Samesite
=Lax` (or the configured value) if the plugin is working.

Note that cookies apart from the authentication cookies are **not** handled by this
plugin, nor it makes sense to add SameSite attribute to them.

See the screenshot as well.

### Do I need to have PHP 7.3 or later?

No. [PHP 7.3 officially added SameSite cookie support](https://php.watch/versions/7.3/same-site-cookies),
but this plugin comes with a polyfill to extend support to all previous PHP versions.

### Is WordPress vulnerable to CSRF attacks without this plugin?

Without SameSite cookie, WordPress core and third party plugins must implement their
own CSRF checks, which can be overlooked, [intentionally ignored](https://wordpress.org/plugins/comment-form-csrf-protection/),
or sometimes not even have thought about, which can be the case for contributed 
plugin. This plugin attempts to solve this with different take and complement existing
solutions.

## باھالاشلار

![](https://secure.gravatar.com/avatar/3f08ba3325909ad31dca12032899b52d3ee5c4a7a7e92aca5c216ded95bceba0?
s=60&d=retro&r=g)

### 󠀁[2024  This plugin DOES work.](https://wordpress.org/support/topic/2024-%e2%86%92-this-plugin-does-work/)󠁿

 [Fer](https://profiles.wordpress.org/ferfactory/) 2024-يىلى 14-ماي

Looks like nobody read the FAQ: The plugin doesn’t work !?!? Yeah, probably. This
plugin uses what’s called “pluggable functions” supported in WordPress to replace
wp_set_auth_cookie function.This means that any other plugin that tampers with the
login cookie parameters will override this plugin, and this plugin may not even 
get a chance to do what it does. In my case, the issue was with the plugin WPS Hide
Login. Disable that other plugin and this plugin worked correctly.EDIT: In case 
you still want to change the login URL, use the plugin Admin login URL Change.

![](https://secure.gravatar.com/avatar/16565b2baf17499a0d6bb1d111ae2480238987e5f414eea2bec5facedd13b4e9?
s=60&d=retro&r=g)

### 󠀁[The plugin doesn’t work](https://wordpress.org/support/topic/the-plugin-doesnt-work-43/)󠁿

 [tranhoang](https://profiles.wordpress.org/tranhoang/) 2021-يىلى 16-ئىيۇل

I don’t know why the Author created this plugin, It does not work, please remove
it from the plugin library

![](https://secure.gravatar.com/avatar/93af0c8ae062b5b3efc426e8585ebe23a4d762d8104f55fa9229be717720274c?
s=60&d=retro&r=g)

### 󠀁[Wasted two days on this](https://wordpress.org/support/topic/wasted-two-days-on-this/)󠁿

 [Rab Nawaz](https://profiles.wordpress.org/rnawaz02/) 2020-يىلى 15-سېنتەبىر

It does not work

![](https://secure.gravatar.com/avatar/bf350b03ea89f10db47db197e1408fd185647cbf5a9b9f5e6c4ea832196c1199?
s=60&d=retro&r=g)

### 󠀁[it’s works](https://wordpress.org/support/topic/its-works-26/)󠁿

 [ramazan12345](https://profiles.wordpress.org/ramazan12345/) 2020-يىلى 5-ئاپرېل

Chrome was showing an error from the developer console. Errors disappeared when 
I installed this plugin. The plugin is working and problem-free. thank you

![](https://secure.gravatar.com/avatar/e77da3eb386c984ca5995a2e33dd3a98474f68c6dfb7c4d90a9fda10abc24be6?
s=60&d=retro&r=g)

### 󠀁[It could work…](https://wordpress.org/support/topic/works-like-a-charm-1645/)󠁿

 [pypmaker](https://profiles.wordpress.org/pypmaker/) 2020-يىلى 4-مارت

It sorted out my problem. And created another – I can’t log into my site with this
plugin installed! Unfortunately….

![](https://secure.gravatar.com/avatar/7cbb07de535853152e3d55e4a218fd4deb60d726f0d39a66509a3fce6e7c2de8?
s=60&d=retro&r=g)

### 󠀁[This plugin does not work](https://wordpress.org/support/topic/this-plugin-does-not-work-33/)󠁿

 [nissimboozaglo](https://profiles.wordpress.org/nissimboozaglo/) 2020-يىلى 29-يانۋار

This plugin does not work for me. In addition, after I installed it, I could not
log back in to the WordPress backend. Had to disable the plugin through WP Engine
to gain back the access. waste of time.

 [ 11 باھالاشنىڭ ھەممىنى ئوقۇش ](https://wordpress.org/support/plugin/samesite/reviews/)

## تۆھپىكار ۋە ئىجادكار

«SameSite Cookies» كودى ئوچۇق يۇمشاق دېتال. تۆۋەندىكى كىشىلەر بۇ قىستۇرمىغا تۆھپە
قوشقان.

تۆھپىكار

 *   [ Ayesh Karunaratne ](https://profiles.wordpress.org/ayeshrajans/)

«SameSite Cookies» 1 تىلغا تەرجىمە قىلىنغان. [تەرجىمانلار](https://translate.wordpress.org/projects/wp-plugins/samesite/contributors)
نىڭ تۆھپىسى ئۈچۈن رەھمەت.

[«SameSite Cookies» نى تىلىڭىزغا تەرجىمە قىلىڭ](https://translate.wordpress.org/projects/wp-plugins/samesite)

### ئىجادىيەتكە قىزىقامسىز؟

[كودقا كۆز يۈگۈرتۈپ](https://plugins.trac.wordpress.org/browser/samesite/)، [SVN خەزىنە](https://plugins.svn.wordpress.org/samesite/)
تەكشۈرۈپ ياكى [RSS](https://plugins.trac.wordpress.org/log/samesite/?limit=100&mode=stop_on_copy&format=rss)
ئارقىلىق [ئىجادىيەت خاتىرىسى](https://plugins.trac.wordpress.org/log/samesite/)گە
مۇشتەرى بولغىلى بولىدۇ.

## ئۆزگىرىش خاتىرىسى

#### 1.5

 * Fixes a cookie expiration issue that was reported multiple times in the issue
   queue. Thanks to Jamie Magin (@jamagin at GitHub).

#### 2.0

 * Requires PHP 7.0+
 * Requires WordPress 6.2+
 * Synced pluggable code from upstream for better compatibility with hooks.

#### 2.1

 * Minor readme.txt updates

## Meta

 *  Version **2.1**
 *  ئاخىرقى يېڭىلانغان ۋاقىت **3 يىل بۇرۇن**
 *  ئاكتىپ ئورنىتىش سانى **700+**
 *  WordPress نەشرى ** 6.2 ياكى يۇقىرى **
 *  **6.3.8** دا سىنالغان
 *  PHP نەشرى ** 7.0 ياكى يۇقىرى **
 *  تىل
 * [English (US)](https://wordpress.org/plugins/samesite/) ۋە [Norwegian (Bokmål)](https://nb.wordpress.org/plugins/samesite/).
 *  [تىلىڭىزغا تەرجىمە قىلىڭ](https://translate.wordpress.org/projects/wp-plugins/samesite)
 * بەلگە
 * [cookies](https://ug.wordpress.org/plugins/tags/cookies/)[csrf](https://ug.wordpress.org/plugins/tags/csrf/)
   [samesite](https://ug.wordpress.org/plugins/tags/samesite/)[security](https://ug.wordpress.org/plugins/tags/security/)
 *  [ئالىي كۆرۈنۈش](https://ug.wordpress.org/plugins/samesite/advanced/)

## دەرىجە

 2.5/5 يۇلتۇز

 *  [  4 5-يۇلتۇز باھالاش     ](https://wordpress.org/support/plugin/samesite/reviews/?filter=5)
 *  [  0 4-يۇلتۇز باھالاش     ](https://wordpress.org/support/plugin/samesite/reviews/?filter=4)
 *  [  0 3-يۇلتۇز باھالاش     ](https://wordpress.org/support/plugin/samesite/reviews/?filter=3)
 *  [  1 2-يۇلتۇز باھالاش     ](https://wordpress.org/support/plugin/samesite/reviews/?filter=2)
 *  [  6 1-يۇلتۇز باھالاش     ](https://wordpress.org/support/plugin/samesite/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/samesite/reviews/#new-post)

[بارلىق ئىنكاسنى كۆرسەت](https://wordpress.org/support/plugin/samesite/reviews/)

## تۆھپىكار

 *   [ Ayesh Karunaratne ](https://profiles.wordpress.org/ayeshrajans/)

## قوللاش

چۈشەندۈرۈشىڭىز بارمۇ؟ ياردەم لازىممۇ؟

 [قوللاش مۇنبىرىنى كۆرسەت](https://wordpress.org/support/plugin/samesite/)