Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] add filter to the cookieDomain param #38

Open
virgo79 opened this issue Aug 1, 2018 · 1 comment
Open

[Feature Request] add filter to the cookieDomain param #38

virgo79 opened this issue Aug 1, 2018 · 1 comment

Comments

@virgo79
Copy link

virgo79 commented Aug 1, 2018

Hi,

the cookieDomain variable is used for sending to javascript the domain in which the cookie will be stored. Currently its value would be the COOKIE_DOMAIN constant if it exists, or an empty string otherwise.

I would like to suggest to give users the opportunity to customize the cookieDomain value before it will be sended to javascript (via wp_localize_script).

In some situations, (like in a multisite environment) this could leads to some troubles if the COOKIE_DOMAIN constant is already defined by the user, for example in wp-config.php.

To be more specific, if the COOKIE_DOMAIN value is different from the current domain in the client's browser the cookie will no more recognized by the $_COOKIE and the plugins does not work.
Consider that this could be a real scenario in a multisite environment with domains mapped to subdomains.

The following could be an easy implementation of the feature request that could be definitely resolve the issue:

'cookieDomain' => apply_filters( 'cn_cookie_domain', ( defined( 'COOKIE_DOMAIN' ) ? COOKIE_DOMAIN : '' ) )

@jocastaneda
Copy link

jocastaneda commented Jan 9, 2021

Just saw t;his one and didn't realize how old it actually was. I've put in pr ( #52 ) and have been trying to keep it up to date too when I can in hopes to see this committed to help a lot of the users of the plugin. [edited to point to correct PR]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants