I've wordpress installed so when a person logs in, it saves a cookie within the temporary files using the title of wordpress.

I wish to retrieve the need for the cookie using php in another page (from wordpress). What will be a approach to retrieve a persistent cookie in php.


Try looking in $_COOKIE.

However, bear in mind, the path might be set dissimilar to where you need to see clearly.

I notice three key value pairs on my small local worpress installation. If you're able to put the php file underneath the same domain, you'll be able to have the snacks because it seems worpress properly sets the cookie to "/". So for example the important thing "wordpress-configurations-1".


    echo "Cookie: {$_COOKIE['wp-settings-1']}";
    echo "<h1>No Cookie Detected from wordpress!</h1>";


It needs to be underneath the same domain. In your area I simply drop this any place in the worpress folder and it'll work whenever you browse into it.

You retain stating that its under localhost. But the thing is, the cookie data will not be available between subdirectories of localhost. such as the cookie set at http://localhost/wordpress will not be offered at http://localhost/drupal .. you are able to only access the snacks of http://localhost/wordpress for the reason that directory or subdirectories from it e.g. http://localhost/wordpress/test-page ..