Session Cookie security questions

The functions that generate, validate and clear auth cookies are all pluggable (meaning you can write your own versions of them). Just note that some of them may need to return something specific (like the user ID). wp_generate_auth_cookie() (generates your cookies) wp_set_auth_cookie (actually sets the cookies) wp_validate_auth_cookie() (validates your cookies) wp_parse_auth_cookie (parses an auth cookie, … Read more

Would this be achieveable?

WordPress doesn’t use sessions at all so it isn’t going to help you “control your sessions”. You would have to incorporate the code yourself. SSI? Server Side Includes? WordPress also doesn’t use Server Side Includes, and neither should you. They technology is ancient, bug prone — also known as susceptible to being hacked — and … Read more

Displaying “One Time” Notification in Plugins

The idea is that you need to save_errors or update the option that has the errors/notices whenever you want. As soon as its output once by admin_notices it will be cleared. /** * Sample_Notice_Handling */ class Sample_Notice_Handling { public static $_notices = array(); /** * Constructor */ public function __construct() { add_action( ‘admin_notices’, array( $this, … Read more

Front end ajax user login session issue

You are not setting an authentication cookie. The second parameter of the wp_signon function is set to false. This function sets an authentication cookie. Users will not be logged in if it is not sent. $user_signon = wp_signon( $info, true ); That should give you the result you desire

Unset session variable on page reload / setup but exclude AJAX

Try using wp_doing_ajax() like so: function unset_filter_session() { if ( ! wp_doing_ajax() ) { //Reset sessions on refresh page unset( $_SESSION[‘expenditure_filter’] ); } } UPDATE You can check the answer’s revision for this update part.. UPDATE #2 Sorry, I didn’t realize that you’re loading a page fragment (#content-area) using the jQuery.load() method. Or that you’re … Read more

Multi-instance WordPress usingn Memcached to handle sessions requests login every time a requests is handled by a different server

The problem was that my *_KEY tokens were being generated each time Kubernetes was creating a new instance, as @Rup and @Tom-J-Nowel rightly pointed. Because my docker image evolved from having an wp-config.php template included to having it generated by the official wordpress docker image I was struggling to see this was a variable. After … Read more

Get my site session in wordpress?

WordPress doesn’t use PHP session ($_SESSION). If you want to use it you need to do at your own. For example: add_action(‘init’, ‘wpse_session_start’, 1); function wpse_session_start() { if(!session_id()) { session_start(); } } But, if you want is to get the user id of the current user, you can use get_current_user_id(): <?php $user_ID = get_current_user_id(); ?>

Safe to start a php session on get_header action?

There’s nothing that requires that get_header run before output starts, you could put it in the middle of a template file after other content and still have a perfectly valid theme. template_redirect is the last action where it is guaranteed that no output has started yet.

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