PHP: $_SESSION destroyed after page reload for my custom session
PHP: $_SESSION destroyed after page reload for my custom session
PHP: $_SESSION destroyed after page reload for my custom session
I resolved my problem using that: (edited define(‘ADMIN_COOKIE_PATH’, ‘/wp-admin’); define(‘COOKIE_DOMAIN’, ‘.website.com’); define(‘COOKIEPATH’, “https://wordpress.stackexchange.com/”); define(‘SITECOOKIEPATH’, ‘.website.com’); define(‘COOKIEHASH’, md5(‘website.com’) );` COOKIEHASH is essential
Deleting expired session tokens in WordPress
If you want to apply this term filter to all queries on the site, then you’ll want to use the ‘parse_query’ action. This action will accept the WP_Query instance as a parameter, which will allow you to add a term filter based on the $_SESSION variable.
Unfortunately, since we aren’t able to see any of your current code, and it’s sort of a vague description of your implementation, it’ll be difficult for anyone to post actual code that will work for you. But to point you to some resources that might help, you might find these helpful: W3 Schools – PHP … Read more
You set the cookie too late. You can use any action before template_include to set a cookie, after that there is already HTML output, and no further headers can be set. Example: add_action( ‘template_redirect’, function() { setcookie( ‘test’, 1 ); });
Just wanted to add my own experience to this thread. I’ve tried many different configurations of WordPress cookie constants in wp-config without any luck. I’m setup in the same way as described by the OP using custom_user_table and meta_table. I’ve found the session information does actually translate across different pages if you use COOKIE_DOMAIN as … Read more
Okay, here is a simple example. init action loads before loading WordPress website. So we can use it to check some special conditions for allowing access to users. You should use this in functions.php function user_custom_redirect() { if ( ‘something’ === ‘something else’ ) { // let user view WordPress website } else { // … Read more
WordPress does not use or affect PHP Sessions in any way. Therefore, the session functions will work exactly the same whether you’re using WordPress or plain PHP or AJAX requests or anything else. However, PHP Sessions depend very heavily on your specific PHP configuration. If you don’t have the PHP Session settings configured correctly in … Read more
You will need to use the authenticate filter: https://codex.wordpress.org/Plugin_API/Filter_Reference/authenticate add_filter( ‘authenticate’, ‘myplugin_auth_signon’, 30, 3 ); function myplugin_auth_signon( $user, $username, $password ) { return $user; } Return a WP_Error object to indicate failure or an issue, or a WP_User object on success. There are also 2 core functions hooked into that filter that will need removing … Read more