i create a cookies as
setcookie('sm_posts['.$key.']', 'value', time()+60*60*24*365);
for an array sm_posts and print these cookies in a wordpress page but if i click on a cross image then it will be delete but it is not working
foreach($_COOKIE["sm_posts"] as $key => $value)
{
setcookie('sm_posts['.$key.']', '', time()-60*60*24*365);
}
please help
Try specifying the path as the next parameter.
Do this for BOTH cookie settings statements (and manually delete all your existing cookies).
But a better solution is to use the WordPress defines for this, COOKIEPATH and COOKIE_DOMAIN.
(Again, manually delete all the existing cookies)