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 do logout redirect to current url

wp_loginout(get_permalink()); will make hyperlink with “Log out/Log in” text and after log out it will stay in the same page, or it will direct user to log in page.

Categories redirect Tags login, redirect

Redirect user after logout

You can use the wp_logout_url() template tag to generate a logout link. You can specify the URL that the user will be redirected to as the first pramiter: wp_logout_url( ‘http://example.com’ ); The above code will generate a URL that looks a bit like this: /wp-login.php?action=logout&_wpnonce=ba51bbcdc3&redirect_to=http://example.com/unsubscribe. You can make it into a link like so: <a … Read more

Categories redirect Tags login, logout, redirect

Using a nonce in a Custom Login Form

using wp-login.php as a template. is not a correct way to do that. Source You’d better use the wp_login_form() function in a custom template. EDIT: And if you want to add an option to reset password you could do this : add_action( ‘login_form_middle’, ‘add_lost_password_link’ ); function add_lost_password_link() { return ‘<a href=”https://wordpress.stackexchange.com/wp-login.php?action=lostpassword”>Lost Password?</a>’; } Source

Categories PHP Tags cookies, login, php

Validate Custom Login field

Here’s the full working code, put it in functions.php: add_action(‘login_form’,’my_added_login_field’); function my_added_login_field(){ ?> <p> <label for=”my_extra_field”>I agree to the terms<br /> <input type=”checkbox” value=”1″ class=”input” id=”my_extra_field” name=”my_extra_field_name”/></label> </p> <?php } function check_checkbox($user, $password) { if( !isset($_POST[‘my_extra_field_name’]) ) { remove_action(‘authenticate’, ‘wp_authenticate_username_password’, 20); $user = new WP_Error( ‘denied’, __(“<strong>ERROR</strong>: Please agree to our terms.”) ); } return … Read more

Categories login Tags authentication, login

Get wordpress stored cookies for custom login

if you are logged in wp_parse_auth_cookie(LOGGED_IN_COOKIE); will return array consisting wp user name, cookie hash and expiration time. This function will return null if you are not logged in. But you cannot get plain password as wordpress doesn’t store plain password.

Categories login Tags cookies, login

How long do users stay logged in if they DON’T check remember me?

Take a look at the source: 832 if ( $remember ) { 833 /** 834 * Filter the duration of the authentication cookie expiration period. 835 * 836 * @since 2.8.0 837 * 838 * @param int $length Duration of the expiration period in seconds. 839 * @param int $user_id User ID. 840 * @param … Read more

Categories login Tags core, login, logout

Check if the front end user is log in or not

write this code in front page to check user is login or not: if ( is_user_logged_in() ) { … }

Categories plugins Tags login, plugins

Finding the login page from database?

Alright! I understand that there is a custom wordpress login url. Also you need to login to a user’s profile. If that’s the case, I suggest a simple hack(If you legally have rights to access/modify the database). Try this: Go to cpanel and login to phpmyadmin and open the database for your website/blog. Find ‘wp_options’ … Read more

Categories Database Tags database, login

User Directory without a Plugin

You might want to read this post about passwords protected posts. In short: Do not use them. QUESTION: Will this strategy keep the info private, or am I missing something? No, it won’t. It will even leak info to search engines and index those. What you can do is to just require the actual user … Read more

Categories login Tags login

Redirect after login based on user role (custom login page)

Try this. It works for me. add_filter( ‘login_redirect’, ‘redirect_non_admin_to_dashboard’), 10, 3 ); function redirect_non_admin_to_dashboard($redirect_to, $requested_redirect_to, $user ) { global $user; if( ! isset( $user->ID ) ) { return $redirect_to; } if ( ! in_array( ‘author’, (array) $user->roles ) ) { $redirect_to = site_url().’/dashboard-teacher’; }elseif( in_array( ‘subscriber’,(array) $user->roles ) ){ $redirect_to = site_url().’/dashboardwwp-student’; }else{ $redirect_to = … Read more

Categories users Tags login, user-roles, users, wp-redirect
Older posts
Newer posts
← Previous Page1 … Page136 Page137 Page138 … 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