From comment:
There is not enough information to answer your question. All your code is javascript, not PHP. Additionally, there is no function named “setCookie” or “getCookie” in javascript, and you don’t state what libraries you are using.
The answer is most likely that your setCookie function is using the current page path (cookies have a URL path component to them), and thus other pages on different URLs cannot access those cookies, but there’s no real way to tell without seeing that code as well.
For JS problems along these lines, you should try a different Stack, this is not a WordPress specific question, but a general javascript issue.
Related Posts:
- Setting up WordPress with Custom Permalinks and no .htaccess File?
- Does WordPress Change the .htaccess File When Updating?
- Move WordPress to subdirectory, keep ALL URLs
- 301 Redirects for Changed Permalink Structure & Category Base
- Permalinks to Custom does not work (out of box)
- WordPress permalinks Yahoo hosting(no .htaccess allowed)
- How do I turn off 301 redirecting posts (not canonical)?
- Permalink Issues by Installing WordPress in Subdirectory / Subfolder
- Passing variables through permalink structure
- WordPress on a subdirectory of Laravel – WordPress pretty permalinks inner page shows laravel
- How to map permalinks with accented letters to sanitized slugs?
- Remove subfolders from URL
- Changing Permalinks to a Custom Permalink causes a 404 Error [no matter what I do]
- Menu Link Redirect Based on Username or User ID
- htaccess or redirect to cloak portion of a link?
- WordPress overrides the GET variables, (page_id) set in HTACCESS
- custom naming of search permalink /search/
- Auto 301 to full post permalink? (using /posts/%post_id%/%postname%)
- Changing URL from /%postname%/%post_id to /%category%/%postname%/%post_id%
- Using only %postname%
- removed index.php now all pages 404
- Rewriting search permalink
- removing index.php IIS 7.5 webconfig
- Rewrite rule never matching
- wordpress permalinks tweeks
- Getting a 500 internal server error ONLY on wp-admin/options-permalink.php
- Redirect user if it’s not logged in
- Custom url for a single page
- Using WP rather than .htaccess to redirect pages/posts
- How to get this JavaScript working with get_permalink
- Test site pages go to main site
- Comment author url link is wrong? How to change from authors/ to author/
- How to redirect RSS feeds to Feedburner and keep pretty permalinks?
- Strange behavior: random HTTP error 500 fixed by visiting Permalinks settings page (htaccess issue with language code)
- how to prefer static page if it exists over wordpress page
- WordPress not generating .htaccess but tells me that (Permalink structure updated.)
- change WordPress permalinks and redirect new urls 301
- how to get permalink
- Why will Pretty URLs not Work?
- Ignore postname in permalink
- Permalinks – .htaccess
- Custom permalink structure with %postname% in front of domain name
- Configuring Home Page Address
- How Can I Use a Custom AccessFileName?
- WordPress Page Not Found if Permalink Settings is Postname
- xammp server permalink by postname not working
- Conditional Permalink based on category?
- Custom permalink structure only saves with index.php inserted
- Problems with permalinks (.htaccess not working)
- old permalinks not found
- What would cause a 500 Server Error with permalinks turned OFF?
- mod-rewrite rules grabs “broken permalinks”, too
- Change author permalink using htaccess?
- Gutenberg Editor: dynamically edit slug field based on ACF field
- .htaccess to redirect to a wp page
- Edit Post Permalink option removed, looking for possible causes
- Got 404 error when changed siteurl via DB in WordPress
- All files in public_html, Cannot launch WordPress site via wp-admin
- Cannot publish posts or pages when I change permalink structure
- wordpress admin panel loop on nginx
- Very strange behaviour related to htaccess and custom posts and custom posts substrings (BUG?)
- No Ones Been Able to Override my WordPress Rewrite Rule Issue!
- My permalinks for all pages and posts now include old page titles as parents/categories
- WordPress All pages but home simply read “hello”
- Issue with my links or permalinks
- Page permalink redirects to home page
- WordPress pages break with custom permalink settings (theme directory not output)
- Remove/hide a specify category-name from the url
- How to rewrite a folder in WordPress?
- LetsEncrypt WordPress on the Raspberry Pi – Nice url’s give 404 with https, http works
- On IIS, stop WordPress from resaving my web.config file when I enter the Permalinks config page
- Can’t access WordPress site in subfolder possibly because of .htaccess redirect from root installation?
- Removing or hiding slug/permalink from htaccess
- Pretty permalinks (again)
- Fresh wordpress installation in sub-directory not accessible
- When using number in url it is redircting to same page but when using character it redirects to 404
- Folder Name and Category Name WordPress
- Once redirected by Rewrite rules, how can WordPress know the page?
- customize urls displayed by previous_post_link and next_post_link
- Removed and Reinstalled WordPress, Redirect Broken now
- .htaccess not working in WordPress
- How do you put your own rules into .htaccess?
- Problem when i configure permalink
- redirect old pages by .htaccess
- custom permlink .htaccess file 404 Not Found error
- Why are all pages redirecting to homepage when using custom permalinks?
- region selection
- Files placed in directory with wordpress 404
- 404 not found error on WordPress local host
- .htaccess regex for redirect subdomain to root domain & redirect old permalinks
- 404 posts error after 301 redirection of changed category / tag base
- Add segment to URL in htaccess
- htaccess strip url
- Use .htaccess to redirect homepage to its permalink
- 301 Redirect posts to newly added categories
- Standard Htaccess directives disappear by themselves
- How to use ‘blogs.dir’ as media upload instead of ‘uploads’ directory in WordPress multisite setup
- Can you customize the automatic permalink population on new posts?
- Accidentally Changed Permalink Structure
- How do I disable the changing of the permalink for published posts (for non-admin)?