I need to write some custom code for a WordPress function, and I need to be able to delete any cookies that start with wp-postpass_
. I know this can be done with jQuery but I’m unsure of how to approach it in PHP.
I have tried Googling and searching on here but I haven’t been able to find anything that matches what I’m trying to do.
Thank you in advance,
Andy
EDIT:
Sorry, I should have mentioned that WordPress appends a random string onto the end of wp-postpass_
hence why I need to find any cookies that start with wp-postpass_
. Apologies, early morning.
So iterate through all cookies and check if there contain
wp_postpass_
and then remove the cookie.If you have access to the $_COOKIE superglobal just do