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

How to check User Role and redirect to specific page according to Role when login in WordPress?

you can do this redirection with this filter : add_filter(“login_redirect”, function ($redirect_to, $requested_redirect_to, $user) { if ( is_a($user, “WP_User”) && user_can($user, “role_to_test”) ) { $redirect_to = home_url(“/page_slug/”); } return $redirect_to; }, 10, 3);

Categories users Tags login, redirect, users

How to password-protect everything except the logo

Redirecting web pages You can save yourself adding code to all templates in your theme by hooking this in instead. function wpse299924_redirect() { if( !is_user_logged_in() ) { wp_redirect( wp_login_url() ); die; } } add_action( ‘template_redirect’, ‘wpse299924_redirect’ ); You’re right that your images and other media will still be accessible to anyone who knows the URL, … Read more

Categories login Tags login, password

Is there any action /filter hook I can use to disable login for some user role?

Yes, there is. You can use authenticate hook: add_action( ‘authenticate’ , ‘check_custom_authentication’, 20, 3 );
 
 function check_custom_authentication ( $user, $username, $password ) {
 if ( is_a($user, ‘WP_User’) && in_array(‘pending’, $user->roles) ) { return new WP_Error(‘pending’, ‘Your error msg’); } }

Categories users Tags login, users

How can I redirect wp-login.php but still allow logout and other actions?

Apparently after 2 days of trying to sort this out, all I needed to do was post here and then the solution would turn up so I could feel like an idiot. 🙂 I was able to tweak the response in this question (Disable Or Redirect WP-login.php) and finally get this to work. If anyone … Read more

Categories login Tags login

Auto login after reset password

$rp_cookie and $rp_path are inside a function but are not initialized inside the function so they are out of scope and thus, empty. You can try calling global $rp_cookie, $rp_path; at the start of your function but I don’t know if those variables have been set at the time your function is running and thus … Read more

Categories login Tags login

Change wp-login to custom URL login page

You might be tempted to do it manually and not use a plugin for this but I strongly recommend doing it with a plugin. The reason being is that when WordPress updates your manual solution will most likely result in loss. Modifying core functions is generally not a good idea and can be difficult for … Read more

Categories plugins Tags login, plugins

How can I prevent anyone from logging into a WordPress failover site?

One sure-fire, yet simple, method is to scramble the AUTH_KEY constant in the wp-config.php file on the backup server. In wp-config.php, change your AUTH_KEY line to append rand(). Example: define(‘AUTH_KEY’, ‘YOUR-SUPER-SECURE-GENERATED-KEY’ . rand()); On every page, the logged-in key is altered. This prevents users from staying logged in. Note: rand() is very insecure. But we’re … Read more

Categories login Tags backup, login

Switch between WordPress websites easy for an end user

Possibly what you’re looking for is ‘single sign on’ or SSO. There’s a plugin called WP Auth Server which provides SSO between WordPress websites without the need for any extra sign-on service. Maybe it’ll do what you want. I don’t have first hand experience with this or SSO in WordPress but have set it up … Read more

Categories customization Tags customization, login

How can I change the email that is inside the default email texts of wordpress?

There is definitely a filter for that! Here is the reference link to wordpress developers page: https://developer.wordpress.org/reference/hooks/password_change_email/ Basically adding this function (with changes) to your functions.php will override your default password reset email. apply_filters( ‘password_change_email’, array $pass_change_email, array $user, array $userdata ) full example: add_filter( ‘password_change_email’, ‘rt_change_password_mail_message’, 10, 3 ); function rt_change_password_mail_message( $pass_change_mail, $user, $userdata … Read more

Categories filters Tags email, filters, login, password, text

Keep user session with custom implementation of user login

wp_signon() actually already calls wp_set_auth_cookie() which is the function that sets the “remember me” cookie, hence you don’t need to manually call that function. And that (wp_set_auth_cookie($user->ID)) is actually the problem in your code, because it’s overwriting the “remember me” cookie that was already set.

Categories login Tags login
Older posts
Newer posts
← Previous Page1 … Page90 Page91 Page92 … 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