WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have to make sure, that the Wordpress cookie set after successful log in, "wordpress_logged_in_[salt-sth]" is set to be available for secure connections only.

It looks like that it´s a filter used in pluggable.php, line 653

$secure_logged_in_cookie = apply_filters('secure_logged_in_cookie', false, $user_id, $secure);

How can I set it to secure, WITHOUT modifiyng the wordpress core files? If I modify the core (set to true) - it´s not possible to logout anymore...

Thank U!

share|improve this question
In addition to the question above: Cookie is secure now, but the user is logged out automatically directly after loggin in. How can I prevent this? Thanks again! – user19512 Aug 21 '12 at 14:55

The advantage of a filter is that you can change a value without modifying core WP files. The filter you list:

$secure_logged_in_cookie = apply_filters('secure_logged_in_cookie', false, $user_id, $secure);

Passes in three values. You just need to build a function that accepts those three values and returns true (or just returns true by default.

This function, for example, merely returns true for whatever value is passed in to that filter:

add_filter( 'secure_logged_in_cookie', '__return_true' );
share|improve this answer
Great, thx for your fast reply - I understand and will try this! – Markus Aug 21 '12 at 14:18
Thank you! I was digging around in pluggable.php to see where the cookies were getting set and found the apply_filter call. This is perfect, and today I learned about WP's __return_true function – phatskat Feb 4 '15 at 14:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.