How to Extend login session times to a Month

By default the login cookie lasts for 14 days if you tick ‘remember me’ 48 hours if you don’t So as a short term fix you probably want to tick ‘remember me’, and to extend that to 30 days you can add an auth_cookie_expiration filter e.g. function auth_cookie_expiration_30_days( $seconds, $user_id, $remember_me ) { if ( … Read more

How to change WordPress cookies to be session-only

The wp_generate_auth_cookie() function is a pluggable function, meaning you can define a function with the same name in a plugin and your version will be used instead of the WordPress core function. The number of pluggable functions is limited, however. If you want a broad solution that works for all cookies, your lower-level Lua approach … Read more

Using session in WP without trouble with the API REST

The only way to make this go away is to not use PHP sessions and use cookies directly instead. PHP sessions are fundamentally incompatible with a lot of page caching and CDN mechanisms e.g. cloudflare, Varnish, or full page caching plugins such as batcache or WP Supercache. PHP Sessions are also turned off and disabled … Read more

Turning on output buffering in a wordpress plugin

Although I realise this is probably not the right way to go about it, I managed to turn on output buffering using the following code in my plugin: add_action(‘init’, ‘rsq_buffering’); function rsq_buffering() { ob_start(); } I probably should be doing any session stuff from within the init hook instead of just all over the place.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)