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

is_user_logged_in returning nothing on custom page

Is my global set up?

As you can see from taking a look at the »Help«-panel, when you’re using my »Current Admin Screen Info« 1), there’re certain points/hooks/filters in code, that need to pass by before a global is set up.

enter image description here

1) Still searching for a better name.

When to hook?

Yesterday, while reading WPSE chat, I had a nice idea that was the base for above mentioned plugin. To give you an idea of how to check if a global is set up, simply read the following code:

function get_hook_for_global()
{
     $global = $GLOBALS['some_global'];
     if ( isset( $global ) )
     {
          remove_filter( current_filter(), __FUNCTION__ );
          return print "Global: $global<br />Set on: ".current_filter();
     }
}
add_action( 'all', 'get_hook_for_global' );

This prints out the contents of the global, as well as the filter where it was set.

Improving the check

If you want to have detailed output, you’ll have to add array/object handling as well:

// Object/Array handling: Dump contents
if ( is_array( $global ) OR is_object( $global ) )
    $global = var_export( $global, true );

Related Posts:

  1. Removing “There is no account with that username or email address.” error message in “/wp-login.php?action=lostpassword”
  2. How to block specific user id in custom login form?
  3. Having trouble creating two shortcodes, one for logged in user and one for visitors
  4. Redirect after login depending on the URL
  5. Redirecting the lost password page request when using a custon login page
  6. Create condition for Author bio Social Links
  7. Change permalink structure specific category
  8. Array data not saving to specified sections. How to make seting independantly?
  9. WP_REST_Response – How to return Gzip answer and add Content-encoding header?
  10. Customizer control save then return to default
  11. Create Columns with Custom Walker and CSS Classes
  12. WP-Bakery – Add custom colors to buttons with template colors
  13. I need to display posts in subcategory beside posts in main category
  14. How can I add diffrent editable text fields?
  15. How can I check that the acf field value is not a duplicate when adding a post?
  16. Adding an Anchor Link to a wordpress menu using WPBakery Page Builder
  17. Integrate otp in my custom singup form
  18. Can’t log in to WordPress wp-admin after adding code to functions.php
  19. Woocommerce template file outputting tags
  20. Hide A Class and Add Custom HTML Code Using WordPress
  21. Check if user had autologin & if so, logout
  22. Featured image in menu wordpres
  23. Trying to update Woocommerce meta values
  24. Admin Panel 404 Error after login
  25. How do I know if the user is a customer?
  26. PHP warning – Use of undefined constant ‘FORCE_SSL_LOGIN’ ‘FORCE_SSL_ADMIN’ on wp-config.php
  27. Log out without confirmation request (nonce)
  28. update_user_meta as multiple value but with same meta key
  29. I want to fusion the product columns in email table order
  30. retrieve “Link Color” value
  31. Inserting a class on before_widget if checkbox is checked
  32. If Statement is Ignored?
  33. Add a new view on the Woocommerce account page
  34. Call WP Rest-Api to GET /users/me returned NOTHING in console
  35. Delete post meta by serialized meta value
  36. How do I add a predefined class to a custom html element?
  37. How can I update the price when someone enters postcode or zip code in woocommerce checkout page?
  38. How to identify which php file a plugin is using on page load?
  39. Restrict wordpress access to logged users only
  40. Adding new divs with custom classes to products on WooCommerce shop page [closed]
  41. Infinite loop when logging out using custom login form
  42. Menu not updating for logged in users after redirect
  43. Dynamic “home” image and URL based on current folder
  44. Dynamic Banner Text based on Subdomain
  45. Create “blank” admin page without having admin-bar/admin-menu for faster load
  46. how to use auth_redirect() redirect visitor to login page if they are not login when they click account and order page?
  47. Issues adding Recaptcha v3 to WordPress Registration
  48. Display specific page if user signed in
  49. Need help transforming echo to return for use with shortcode
  50. Change Login or Logout text based on status
  51. How to separate the taxonomies list from the form so that editing taxonmies is the same as pages and posts?
  52. Noob question: want to remove the “site identity” logo for specific part of website only
  53. Refresh page after login with litespeed cache
  54. Create Schema in WordPress with PHP
  55. Create form which redirects to site in network?
  56. Redirect user role to a specific page on login in a multisite network?
  57. How to add a full working piece of website already coded, to a large scale Website design project?
  58. Need help with AJAX login to call php in functions.php to handle redirects based on user cap (role)
  59. Add custom attribute to product’s HTML to woocommerce cart page
  60. How do I send a POST request with params with WordPress REST API
  61. Create custom admin page with custom text fields
  62. Autoloading Classes in Plugins
  63. Remove specific javascript when viewing page in Customizer?
  64. Search only for posts with specific metadata?
  65. wp-login.php?redirect_to=https problem
  66. is_user_logged_in() not working in homepage
  67. Running local copy of an old WordPress site on MAMP
  68. Remove node from multisites?
  69. Automatically refresh page if widget is added to page?
  70. custom field – changing an element or background of id div – different versions not working
  71. Real time notification on user profile after new comment
  72. Customizing WooCommerce with PHP
  73. Check if a user is logged into my WordPress site which is on a different server
  74. How to add text before posts
  75. Multisite – Display different header content based on which site is accessed
  76. How to get php file based on URL in WordPress
  77. Add two or multiple functions in WordPress Post or Page
  78. What image is this pulling?
  79. How can I customize a WordPress theme before it’s downloaded?
  80. Show content by using tags
  81. How to associate dynamic PHP page for chosen WordPress tag?
  82. Newbie question. Login/Registration. New PHP page
  83. Only display notification on single post
  84. Is there a way to have chunks of a page’s content expire?
  85. Replace Underscore (_) on Space ( )
  86. Where can I find the declaration of `$_wp_theme_features`?
  87. Adding a sidebar to wp-login.php
  88. Static home page ignored
  89. How do I routinely extract the thumbnail of the most recent post?
  90. Why isn’t my custom Javascript showing up in my custom template?
  91. Showing the project type in HREF
  92. WordPress error on my website
  93. List users in a dropdown for login
  94. Display tab title as ‘blog tagline | blog title’
  95. A Customizer checkbox control that sets the setting to “” or to “blank” and show() or hide() a color control
  96. My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
  97. PHP call div with function
  98. Use custom get results query to show posts WordPress
  99. Showing custom field contents without listing description
  100. How can I show only if custom field has content [closed]
Categories PHP Tags customization, login, php
How to make a metabox that contains link categories?
product export and import using xml

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