A password is not the only factor protecting a WordPress account. After login, the browser receives an authentication cookie that confirms the active session. If an attacker obtains its value, they may in some cases act as the user without entering the password again.
That is why you should check not only password strength, but also the conditions under which cookies are created, transmitted, and stored. Below is a practical checklist for WordPress, wp-admin, and sites that use Elementor, AJAX requests, or external integrations.
Which cookies WordPress uses
When a user logs in, WordPress creates authentication cookies to identify the user and their session. Their names may begin with wordpress_, while secure connections often use variants with the wordpress_sec_ prefix. Cookies may also be created for comments, preferences, or third-party plugins.
Cookie values should not be copied, published, or shared in chats. Even if a value looks like a random string of characters, it may serve as a key to an active session.
The following attributes are especially important for the admin panel: Secure, HttpOnly, and SameSite. You should also review Domain, Path, the expiration period, and how the session is terminated.
- Secure — the browser sends the cookie only over HTTPS.
- HttpOnly — browser JavaScript cannot read the cookie through document.cookie.
- SameSite — determines whether the cookie is sent during navigation and requests originating from external sites.
- Expires or Max-Age — determine how long the cookie remains valid.
- Domain and Path — restrict the sites and URL paths where the cookie is used.
What Secure, HttpOnly, and SameSite mean
The Secure attribute ensures that an authentication cookie is not sent over ordinary HTTP. If a site is available through both http:// and https:// without proper redirection, some requests may remain unprotected. This is unacceptable for an admin panel.
HttpOnly reduces the risk of cookie theft through an XSS vulnerability: a script on the page cannot directly read the cookie. However, this attribute does not remove the XSS vulnerability itself and does not protect against session theft through other methods.
SameSite=Lax is usually a practical compromise for a standard website: the cookie is sent during typical navigations to the site but is restricted in many cross-site requests. SameSite=Strict provides stricter limitations, but it may affect certain login flows, links from emails, or external integrations.
Not all site cookies have the same requirements. For example, a payment service, SSO, external builder, or widget may require a different SameSite policy. Do not change attributes globally until you have tested critical scenarios.
- Secure should be enabled for the admin session cookie.
- Authentication cookies should preferably have HttpOnly enabled.
- Start with SameSite=Lax unless there is a confirmed need for Strict.
- Do not confuse SameSite with complete CSRF protection: WordPress and plugins also use nonces and capability checks.
How to check cookies in a browser
Perform the check after logging into the admin panel, not only on the home page. Open the browser’s developer tools and go to Application or Storage, then Cookies and the site’s domain. Tab names may vary slightly between browsers.
Find the WordPress authentication cookies and check the Secure and HttpOnly flags, the SameSite value, the domain, the path, and the expiration time. There is no need to view or copy the cookie value for publication.
Also open the Network tab, refresh the wp-admin page, and review the HTTPS requests. The cookie should not be sent to HTTP addresses in request headers. If the browser displays a warning about insecure transmission or blocked cookies, fix HTTPS and the domain configuration first.
- Check the site with and without www if both variants are available.
- Check the primary domain and subdomains if the admin panel is hosted separately.
- Run the test in a private window after clearing old cookies.
- Test login, logout, opening the Elementor editor, saving changes, and uploading media files.
Checking server headers
For an initial check, you can review the response headers from the login page. The command displays headers only and does not replace testing the actual browser session.
- Make sure the HTTP version redirects to HTTPS in one correct chain.
- Check that no authentication cookie is created without Secure.
- If a CDN or reverse proxy is used in front of WordPress, check the headers on the public domain, not only on the server.
curl -I https://example.com/wp-login.php
How to enforce HTTPS for login and wp-admin
The certificate must be valid, and all domain variants must lead to the correct HTTPS address. A redirect alone is not enough if WordPress or the proxy treats the request as HTTP and generates insecure links or cookies.
In a standard WordPress configuration, the FORCE_SSL_ADMIN and FORCE_SSL_LOGIN constants in wp-config.php can be used to protect the administrative area. Add them only after confirming that HTTPS is detected correctly by the server and the reverse proxy.
If the site operates behind a CDN or load balancer, internal HTTP may be used between the proxy and WordPress. In this setup, information about the original HTTPS request must be passed correctly and the server must be configured accordingly; otherwise, redirect loops or login problems may occur.
- Do not edit wp-config.php without a backup and access to the file system.
- After changing the settings, test logout, logging in again, and wp-admin functionality.
- Do not leave multiple canonical admin panel addresses in use at the same time.
- Mixed HTTP resources, proxy errors, and caching may look like cookie problems even when the actual cause is the HTTPS configuration.
define( 'FORCE_SSL_ADMIN', true );
define( 'FORCE_SSL_LOGIN', true );
Session lifetime and ending active logins
A long-lasting session is convenient, but it increases the period during which a stolen cookie may remain useful. Administrators should use a shorter, controlled login period, avoid saving sessions on shared or чужих devices, and log out of the admin panel after finishing work.
After changing a password, detecting suspicious activity, losing a device, or removing an unknown administrator, end all active WordPress sessions. The user profile usually provides an option to end other sessions; the exact location may depend on the WordPress version and the user’s role.
Ending sessions does not replace an investigation. If there are signs of a compromise, change the WordPress, hosting, FTP or SSH, database, and email passwords, and check administrators, plugins, themes, and login logs.
- Do not use a shared administrator account for multiple people.
- Give users only the roles they need.
- Enable multi-factor authentication for administrators.
- Do not save a password or active session in a browser on a public computer.
Common mistakes when configuring cookies
The most common mistake is trying to add Secure, HttpOnly, or SameSite through a random plugin or PHP snippet without understanding which cookies are created by WordPress, the server, and third-party services. This can break login, AJAX requests, the Elementor editor, payments, or SSO.
Another problem is an overly broad Domain attribute. A cookie available to all subdomains has a wider impact area. If there is no objective need to share a session between subdomains, it is better not to expand its scope.
You should not set HttpOnly for a cookie that JavaScript genuinely needs to read. However, WordPress authentication cookies should not be accessible to scripts without a compelling reason. Test changes in a separate browser window after deleting old cookies.
Page caching, CDNs, and WAF security rules can also affect authentication. The admin panel, login page, and personalized requests must not be served to users from a shared cache.
- Do not copy a cookie configuration from another site without checking its architecture.
- Do not disable protection simply because an integration is unstable.
- After making changes, test mobile browsers, different domain variants, and all critical forms.
- Keep WordPress, Elementor, themes, and plugins updated: secure cookies do not fix vulnerable code.
Frequently asked questions
Is the Secure attribute alone enough to protect WordPress cookies?
No. Secure protects cookie transmission from being used over HTTP, but it does not solve XSS, a stolen device, weak passwords, or a vulnerable plugin. HttpOnly, an appropriate SameSite policy, HTTPS, updates, and access control are also required.
Can SameSite=Strict be set for all site cookies?
Not always. Strict may affect external navigation, SSO, payments, and other integrations. The policy for an authentication session should be selected after testing, and third-party service cookies should not be changed without understanding their purpose.
What should I do if cookies or login stop working after enabling HTTPS?
Clear old cookies and check the WordPress and site addresses, redirects, reverse proxy settings, and caching. Also check for redirect loops and confirm that the server correctly detects the original HTTPS request.
Do all cookies need to be deleted after changing a password?
The user should end all other active WordPress sessions, especially after suspicious activity. Local cookies can also be cleared, but this is not enough if sessions have already been stolen or an unauthorized person has gained access to the site.
Conclusion
A secure WordPress cookie configuration starts with complete HTTPS coverage for login and wp-admin and is then verified at the browser level: Secure, HttpOnly, SameSite, Domain, Path, and expiration. Test Elementor, AJAX, media uploads, and external integrations separately.
Do not change cookie settings blindly. Keep the site updated, use separate accounts with minimal privileges, enable multi-factor authentication, and end active sessions after suspicious events.