I'm trying to set the cookie to my site to hide a div on click action. Description of the problem.

  1. I wanna set the cookie for the whole site not for particular page. I'm setting the cookie on click the div by


  1. when I'm clicking the div on home page the div is invisible throughout the site. but if I'm trying to remove my div on other page it is not invisible throughout the site.

  2. I've tried the following functions of the wordpress codex

site_url() get_site_url() home_url() get_option('home')

by these methods I've named the domain but it is not working. I've also tried / for the domain name it is also not working. these all are not working for me. please suggest me some other method to do that.

My plugin site consist of 4 pages

url as follows


1 Answer 1


in domain Name I've used this

$urlOfSite =  get_option('home');
$url = parse_url($urlOfSite, PHP_URL_PATH);

url path . This is working for me .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.