Blog |Follow Nick on Twitter| About

UPDATE: This Plugin has been updated, the below links to the new file, but please comment on the new post, thanks.

I've been busy this AM, my site is a little bit integrated with WordPress, basically I call the header and footer from WP so that my custom code changes themes when WordPress does :)

I want to take it further and use the authentication cookie, so that my code recognizes me when I log in (in the same way WordPress does). In order for to see the cookie set by, I need to change the COOKIEPATH. The change is actually quite simple, in fact the "set cookie" function is a pluggable one :D

The function / plugin I've written is really simple, all I've done is change the PATH to be / (root) that way or can reference the cookie, and because it's set to / the plugin can be used on any site !

To install:

  • Save root-cookie.txt in your plugins directory as root-cookie.php (Right Click - Save As)
  • From the Plugin Manager in the Dashboard, "Activate" the plugin
  • Log out, and log in again
  • Done

Now your cookie can be referenced from any custom code you may have written outside of your WordPress install directory !



Nick Bettison ©