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

force user to re-login after 4 hours – how?

The easiest way is to change the authentication cookie expiry time. add_filter(‘auth_cookie_expiration’, ‘wase_85171_expiry’,10,3); function wase_85171_expiry($expiry, $user_id, $remember) { return 14400; // or calculate the time remaining till the time you want it to expire } People can extend the cookie expiry in the browser, but I don’t believe anyone will bother

Categories login Tags login

Are there ways of logging in that bypass wp-login.php altogether?

The answer is most likely XML-RPC which is used to communicate with the mobile wordpress apps and is always on in newer versions. If you don’t use mobile apps to admin your WP you can use my plugin – http://wordpress.org/plugins/control-xml-rpc-publishing/ to disable it.

Categories login Tags authentication, login

is_user_logged_in not working to redirect only logged out users

You need to wrap the first three || conditions in additional parentheses so they are evaluated first BEFORE the last && condition: Psuedocode example: here here ↓ ↓ if ( (condition || condtion || condition) && ! condition ) { //do business logic… } This now means that: If any ONE of is_paged() OR is_author() … Read more

Categories functions Tags functions, login, wp-redirect

Check if user is logged in when clicking certain links on certain pages

You might start by looking at the is_user_logged_in() pluggable function. https://developer.wordpress.org/reference/functions/is_user_logged_in/ This is basically two lines: $user = wp_get_current_user(); return $user->exists(); In your case, wrap the links inside the curly braces of a conditional. if ( is_user_logged_in() ) { // link }

Categories PHP Tags jquery, login, php

WordPress Login page trashed

To solve this problem using a file manager (or FTP), rename your plugins folder. You can rename it anything – for example, “backupplugins”. This will disable all plugins. You’ll also need to clear your browser cache/history completely or use an incognito window so your browser doesn’t continue redirecting you. Once you can log in successfully, … Read more

Categories login Tags login

Adding HTML to login page under the body tag

If you look the wp-login.php file, you will see a hook login_header. So you add any custom content above the login form. Here is the example: add_action( ‘login_header’, ‘wpse330527_add_html_content’ ); function wpse330527_add_html_content() { ?> ENTER YOUR HTML CODE <?php } You will add the code into functions.php file of your active theme.

Categories login Tags login

How can I allow password reset based on logins containing the @ character?

Create a custom template for forgot password and add forgot password page link to WordPress login page using theme functions.php. Please see the code given below and modify conditions as per your need. <?php /* * Template Name: Forgot Password */ global $wpdb; $error=””; $success=””; // check if we’re in reset form if( isset( $_POST[‘action’] … Read more

Categories users Tags login, password, users

How to shutdown wordpress login temporarily

You could hook into the wp_authenticate_user filter and return an error. Something like: add_filter( ‘wp_authenticate_user’, ‘wpse_406123_stop_login’, -1 ); function wpse_406123_stop_login() { $message = new WP_Error( ‘login_disabled’, __( ‘<strong>ERROR</strong>: You cannot login at this time’ ) ); return $message; } You can then change your security keys –the ones that look like this to something different … Read more

Categories login Tags login

Last time a user logged in

I don’t see anything like it in the database, so you probably have to do this yourself. To save the last login time, you can hook into the wp_login action, and save a user meta value (like [myprefix]_lastlogintime). You first read this value, so you get the previous login time, save this in the session, … Read more

Categories customization Tags customization, date-time, login, users

Force user to login in home page

template_redirect is called on every page load including the home page so your code will redirect the user to the homepage even when user is visiting the homepage You could add another condition there, is_home() or is_front_page(), depending on the setting in admin, but i recommend a longer approach for better compatibility a) Hook into … Read more

Categories login Tags customization, login
Older posts
Newer posts
← Previous Page1 … Page127 Page128 Page129 … 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