Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

login

Login with cookie but without using WordPress code

I can’t believe I actually managed to find this answer on my own!!! 😀 In case anyone else is ever curious about this: The name of the cookie is defined in the constant LOGGED_IN_COOKIE To get the value thereof just setup an action like so: add_action( ‘set_logged_in_cookie’, ‘action_set_logged_in_cookie’, 10, 5 ); function action_set_logged_in_cookie( $logged_in_cookie, $expire, … Read more

Categories login Tags cookies, login

How can I secure a WordPress blog using OpenID from a single provider?

I had a very similar situation, but I am using it for a family member with an illness to provide updates to the wider friends and family without relying on the primary caretaker to give these updates and a blog seemed the best way. We also wanted to allow people to add comments to the … Read more

Categories users Tags login, openid, security, single-sign-on, users

How to redirect to a passworded page based on password entered on login screen

Here’s the solution I came up with that relies on the info already present in the database. Background Each password-protected post stores the password in plaintext in the wp_posts table (in the post_password column). We can use that to query the db for any posts that have that password assigned and get the post info … Read more

Categories custom-post-types Tags custom-post-types, login, password

Logging in redirects to correct page but shows logged out content until forced refresh

Logging in redirects to correct page but shows logged out content until forced refresh

Categories functions Tags functions, login

Associate Page with User

I’ve answered a similar Question and the same code can be adapted for this case. This creates a Meta Box where you can assign a user to a specific post/page, and the information is stored as a Custom Field. The following can be put in functions.php or in a functionality plugin (see: Where to put … Read more

Categories pages Tags customization, login, pages, users

Removing labels and tag on WordPress’s default login form

Thanks to @dalbaeb for pointing me in the right direction – I didn’t realize you could target a label element with its attribute value. The resulting style for targeting the <br> tag after the label is so: label[for=user_login] > br, label[for=user_pass] > br { display: none; } MDN documentation for attribute selectors can be found … Read more

Categories filters Tags filters, hooks, jquery, login

How to turn off redirection from ‘domain.com/login’ to ‘domain.com/wp-login.php’

If you look at canonical.php you will notice that the wp_redirect_admin_locations function is hooked very late– at priority 1000. This means that just about any function hooked to redirect_canonical runs before this one. So, conditionally remove wp_redirect_admin_locations from the template_redirect hook. add_action( ‘template_redirect’, function() { $requ = untrailingslashit($_SERVER[‘REQUEST_URI’]); if (site_url(‘login’,’relative’) === $requ ){ remove_action( ‘template_redirect’, … Read more

Categories PHP Tags login, php, redirect

WordPress check if user is logged in from non wordpress page

Simply place define( ‘WP_USE_THEMES’, false ); include ‘wp-load.php’; on to of your template files (before everything else). This loads the whole WP core.

Categories categories Tags categories, login

Get user ID after logging in

wp_login hook provides access to two parameters: $user->user_login (string) and $user ( WP_User ). To pass them into your function you will need to add a priority (default is 10) and request 2 arguments from the add_action() call: function login_cookie($user_login, $user) { global $wpdb; var_dump($user); // get WP_User object //Get current user ID $id = … Read more

Categories login Tags cookies, login

How do I redirect upon login a specific user based on role?

filter login_redirect: function my_login_redirect_contributors() { if ( current_user_can(‘contributor’) ){ return ‘url-to-redirect-to’; } } add_filter(‘login_redirect’, ‘my_login_redirect_contributors’);

Categories functions Tags functions, login, redirect, user-roles
Older posts
Newer posts
← Previous Page1 … Page139 Page140 Page141 … Page164 Next →
+ More

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Post Navigation Elementor
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • WPFacet multiple loop displaying duplicate content
  • Get the name of the template/*html file used
  • Fix: WordPress.DB.PreparedSQL.NotPrepared Plugin Check (PCP)
  • Removing unnecessary CSS and JS code from wp_head()
  • hexagonal image gallery. Am I on the right track? [closed]
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
© 2026 Read For Learn
Next Page »
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress