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

Redirect to referring page after logging in

I’m not sure I understand your setup, but here are few ideas: A) Display a login link with the redirect_to parameter set: You could add the following to your custom template pages: if( ! is_user_logged_in() ) { printf( ‘<a href=”https://wordpress.stackexchange.com/questions/169704/%s”>%s</a>’, wp_login_url( get_permalink() ), __( ‘You need to login to view this page!’ ) ); } … Read more

Categories redirect Tags login, redirect

Adding extra authentication field in login page

First of all, I would advise against editing the core files as it will be overwritten when you next update WordPress. Also, you should update WordPress, because it will often include security updates. (It’s recently been reported that there has been a spate of attacks on sites using outdated WordPress versions) In order to achieve … Read more

Categories login Tags authentication, customization, login

How to protect pages with double authentication: password + email (in custom field)

When you set a post as password protected, the protection happen on get_the_content() function. There WordPress check for a post password cookie, and if not set, not valid or expired then show the password form. This password form is submitted to wp-login.php, there a cookie is setted according to the password wrote in the form, … Read more

Categories posts Tags custom-field, login, password, posts

wp_signon returns user, but the user is not logged in

get_currentuserinfo() didn’t work for me. I’ve written about this problem and solution at my blog: http://blog.rhysgoodwin.com/programming/wordpress-wp_signon-current_user-is-not-populated/ Cheers, Rhys

Categories login Tags login

How to redirect/rewrite all /wp-login requests

To answer you question as a apache URL layout configuration via mod_rewrite (the apache module that handles URL rewriting), this could be helpful: RewriteRule ^admin/(.*)$ /wp-admin/$1 [QSA,L] (untested configuration directive, check the docs in case this does errors) This will basically translate any request to /admin/… into /wp-admin/… . If that’s the only thing you … Read more

Categories wp-admin Tags login, url-rewriting, wp-admin

How to prefill the username/password fields on the login page

The Result Username You can declare the form field value global and prefill it. This will override any setting done via the “Remember me”-Checkbox. /** * Changes the default user name to “DEMO” * * @return string $user_login */ function login_form_username() { global $user_login; return $user_login = ‘DEMO’; } add_action( ‘login_head’, ‘login_form_username’ ); Password I … Read more

Categories login Tags login

Custom login form

The login form is a simple html form sending username and password to wp-login.php. This is the simplest way to create a custom login form: <?php $redirect_to = ”; ?> <form name=”loginform” id=”loginform” action=”<?php echo site_url( ‘/wp-login.php’ ); ?>” method=”post”> <p>Username: <input id=”user_login” type=”text” size=”20″ value=”” name=”log”></p> <p>Password: <input id=”user_pass” type=”password” size=”20″ value=”” name=”pwd”></p> <p><input … Read more

Categories login Tags login, wp-login-form

Login redirect to previous page

You can filter the login_redirect function like so, adapt according to your needs. add_filter(‘login_redirect’, ‘redirect_previous_page’, 10, 1); function redirect_previous_page( $redirect_to ){ global $user; $request = $_SERVER[“HTTP_REFERER”]; if ( in_array( $user->roles[0], array( ‘administrator’) ) ) { return admin_url(); } elseif ( in_array( $user->roles[0], array( ‘subscriber’) ) ) { return $request; } return $redirect_to; } Update 1: … Read more

Categories redirect Tags login, redirect

How to change “You must be logged in to post a comment.”

You can try to modify it with the comment_form_defaults filter: /** * Modify the “must_log_in” string of the comment form. * * @see http://wordpress.stackexchange.com/a/170492/26350 */ add_filter( ‘comment_form_defaults’, function( $fields ) { $fields[‘must_log_in’] = sprintf( __( ‘<p class=”must-log-in”> You must <a href=”https://wordpress.stackexchange.com/questions/170490/%s”>Register</a> or <a href=”https://wordpress.stackexchange.com/questions/170490/%s”>Login</a> to post a comment.</p>’ ), wp_registration_url(), wp_login_url( apply_filters( ‘the_permalink’, get_permalink() ) … Read more

Categories comments Tags comments, login, user-registration

What is $interim_login?

The variable $interim_login is TRUE when the log-in session of a user expires while she is working in the back end, for example during an auto-save action. In this case a message asking to log in again appears at the bottom of the editor: The same can happen in the theme customizer. The $_REQUEST variable … Read more

Categories login Tags authentication, login
Older posts
Newer posts
← Previous Page1 … Page157 Page158 Page159 … Page162 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
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 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