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

Interim-Login form on frontend

Here is a short plugin that adds the interim-login lightbox on every frontend page:

<?php

/*
Plugin Name: Interim Login Everywhere
Version: 1.0.1
Plugin URI: http://nowhere.com
Description: Provide interim login screens on all pages.
Author: S Valentine

*/

function ile_enqueue_scripts() {
    // we only care to add scripts and styles if the user is logged in.
    if ( is_user_logged_in() ) {

        // add javascript file
        wp_register_script( 'wp_auth_check', '/wp-includes/js/wp-auth-check.js' , array('heartbeat'), false, 1);
        wp_localize_script( 'wp_auth_check', 'authcheckL10n', array(
            'beforeunload' => __('Your session has expired. You can log in again from this page or go to the login page.'),
            'interval' => apply_filters( 'wp_auth_check_interval', 3 * MINUTE_IN_SECONDS ), // default interval is 3 minutes
        ) );
        wp_enqueue_script ('wp_auth_check');

        // add css file
        wp_enqueue_style( 'wp_auth_check','/wp-includes/css/wp-auth-check.css', array( 'dashicons' ), NULL, 'all' );

        // add the login html to the page
        add_action( 'wp_print_footer_scripts', 'wp_auth_check_html', 5 );
    }
}
add_action( 'wp_enqueue_scripts', 'ile_enqueue_scripts' );

// make sure the stylesheet appears on the lightboxed login iframe
function ile_enqueue_login_scripts() {
    wp_enqueue_style( 'wp_auth_check','/wp-includes/css/wp-auth-check.css', array( 'dashicons' ), NULL, 'all' );
}
add_action( 'login_enqueue_scripts', 'ile_enqueue_login_scripts' );

?>

Related Posts:

  1. wp_set_auth_cookie() doesn’t work in Ajax call
  2. WordPress AJAX Login Screen
  3. Detecting post type within init action
  4. WordPress Ajax Login without page reload
  5. WordPress Nonce Issue for Ajax Login and Logout
  6. How can I automatically login using a URL?
  7. how to use reCaptcha v3 in wordpress custom login form?
  8. Is it safe to manually sign a user in using AJAX?
  9. Why a strange discrepency between get_current_user_id() when using AJAX versus output of document.cookie?
  10. Ajax login without redirect/reload
  11. Custom Login with Ajax not working with IE
  12. jQuery.post returns 0
  13. Ajax login fails: script sets cookies, but is_user_logged_in() returns false
  14. WordPress custom ajax login not working on mobile browsers
  15. Google Maps API throws “Uncaught ReferenceError: google is not defined” only when using AJAX
  16. Initialize TinyMCE editor / visual editor after AJAX insert
  17. WP-AJAX vs WP REST API: What to use for requests to the website from outside?
  18. SSL breaks customizer: page isn’t returned from ajax
  19. Using Nonces for AJAX that only retrieves data
  20. How to verify nonce from Bulk/Quick Edit in save_post?
  21. How to implement AJAX post navigation into WordPress?
  22. wp_ajax_[service] returning 0
  23. Ajax function returns -1
  24. Problems with creating sortable sections in customizer
  25. Is it OK to use a system cron to trigger a function hooked into the AJAX API
  26. Filter WP user acf field by ajax
  27. Ajax Request not coming back to class
  28. fetching via fetch/ajax gutenberg block data from third party
  29. How to make ajax content indexable by search engines?
  30. Conditional action hooks
  31. AJAX requests broken due to HTTPS for wp-admin
  32. Is it safe to use $_POST directly in my plugin instead of using admin-ajax.php to receive data from ajax?
  33. How to make get_theme_mod work with AJAX in the customizer preview
  34. How to declare a JS variable in an AJAX call
  35. Fatal error: Call to undefined function get_post() with ajax
  36. how to send Ajax request in wordpress backend
  37. wp_create_nonce() in REST API makes user->ID zero
  38. ajax nonce verification failing
  39. Plugin: AJAX query external API to sync to tables
  40. splitting the URL using jQuery
  41. How do I get reusable blocks via frontend REST API?
  42. Is there builtin way to use protected AJAX endpoint?
  43. WordPress admin-ajax.php not available for subscribers/contributors
  44. WP Ajax never returning any data / calling action
  45. Refresh Markercluster after ajax call
  46. How to load content from many posts on a page, only if needed
  47. Mapping Backbone Models to serialized array in wp_options table
  48. WordPress Settings api data not sanitized if i use ajax
  49. wp_mail 200 response but no mail sent
  50. Ajax calls from the theme directory
  51. How to pass parameters from jQuery ajax into PHP function?
  52. ajax is returning 0
  53. Ajax call with javascript in post content (not enqueued)
  54. What’s the latest I can hook into wp_ajax_%?
  55. Nonce doesn’t validate in nopriv call
  56. How to use ajax to get multiple outputs?
  57. Get returned URL from wp_remote_post if response code is 302
  58. Change URL without reload Ajax
  59. Admin-ajax.php 400 error in custom theme
  60. Why does check_ajax_referer give a 403 error on https websites?
  61. WordPress is creating nonce as a logged in user but verifying it incorrectly
  62. Hide Load more Ajax button if there is no more users to load or less than the number?
  63. How to get setting from separate file?
  64. Contact form – ajax, wp_mail
  65. WordPress function not defined in AJAX call
  66. admin-ajax.php calls fail if referrer is sent with 500
  67. AJAX not working when clicking load more button, when two terms are present in tax_query
  68. AJAX – get_posts for a specific post type returns empty
  69. Admin Ajax always return 0
  70. Ajax call undefined index
  71. Is there a hook that fires after an ajax call?
  72. Dynamic Twitter card images
  73. error_log() not working within wp_ajax_{action} handler
  74. Is there a way to add ajax hooks without editing the functions.php file?
  75. Implement AJAX to fetch pages or posts content in a WordPress custom theme
  76. Assign author on ajax wp post insert
  77. Ajax a php file that has Advanced Custom Fields in it
  78. AJAX is not submitting data to database
  79. Display SOLDOUT text in Dropdowns of Variable Product in WooCommerce [closed]
  80. Using AJAX to load div doesn’t always work
  81. Turn a URL into content preview
  82. Deploy Subcategories with Ajax not working
  83. Allow guest to update custom post met using ajax
  84. Simulate a specific page when making AJAX calls
  85. How to load post_meta for custom post type via Ajax
  86. wp_signon not working fine and 302 moved temporarily?
  87. Disable Ajax for Spiders
  88. what’s the way to access variables from serializeArray
  89. WooCommerce AJAX cross domain add to cart
  90. Call pre_get_posts inside ajax
  91. How to get data with Select AJAX PHP
  92. Add “load more” functionality to an AJAX response
  93. Bad Request 400… jQuery ajax post of json data to wordpress admin-ajax.php
  94. weird Internal Server Error – no error log produced
  95. Why are the most recent posts not appearing in a fetch request, unless I’m logged in?
  96. Successful ajax call returns lots of whitespace and text of code with 0
  97. How to submit a button automatically after every scheduled hours?
  98. At what stage does wp_ajax hooks gets applied during WordPress request?
  99. Getting featured image from WP_Query
  100. Clicking “Show More Comments” loads the same visible comments [closed]
Categories ajax Tags ajax, login
Is it possible to retrieve all posts with a certain value for metadata?
How do I retrieve a users’ last 5 posts?

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
  • 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