Well it wouldn’t always work unless you global $user_id. is_user_logged_in will however work without that extra line of code. The speed improvement is most likely so small it’s less than the speed improvement between single and double quotes and not even worth thinking about.
Also $user_id variable may disappear in a new version and would promptly break your code, were as is_user_logged_in will be about for ages even if they decide to deprecate it.
Related Posts:
- Setting admin edit panels & metaboxes positions and visibility for ALL users and admins
- Can an admin check passwords of registered users?
- How to obtain the user ID of the current profile being edited in WP-Admin?
- Modify CSS via Theme Control Panel
- Hide update messages from non-admin users?
- How to remove “Super Admin” from All Users for those that are not a “Super Admin”?
- Add extra field when admin create user
- Add a custom column in users list page
- Customize Admin Users Screen based on Role
- Make certain pages uneditable by editors?
- wp-admin: Sort users by surname
- Add User meta fields, which only admin can edit
- How to display only logged in user’s post comments in comments area
- Add Admin User via SQL
- Can you have the users list pre sorted by specific column?
- How to remove Gravatar from Username column
- Help extending custom drag-drop page ordering on admin page list screen
- How do I enable new account notification emails (to the administrator)?
- In administration, how do I display comments of a certain user?
- New users must comment when requesting username
- user-new.php less detailed after WP3.1; how to revert?
- Get current logged in user under 3.1, re: remove “Howdy”
- Manage users custom column add class “num”
- Hide one admin from another admin
- How to make custom column Admin>Users sortable?
- Force to use STRONG users password and implement rule to prevent REUSE [closed]
- How can I make the user names of commentors clickable links to the user’s profile from the admin comment screen?
- Keep Logged in Users out of Admin Panel
- Shared account / dual blogging in WordPress
- I’m a super admin and I want to give an admin the ability to add new users…?
- Return User Meta text as links to post edit inside the user columns
- Redirect admin 403 “Cheatin uh?” admin pages
- Given multiple admin accounts, how can I make it so that only admin with X username can edit posts
- How should I setup the “Users” area to hand over to a client?
- How to show a custom notification to a specific user?
- Want to know who is login Admin/User
- Control Users listed in Users List on dashboard
- How should I change the username of or delete the admin user?
- Prevent Registration Where Role is None?
- Extending the user profile [closed]
- Show metadata in users.php – wordpress
- Hide top admin panel for non admin and non editors
- When admin approves a registered user, I don’t want to send a notification email to users
- Is it possible to create a custom admin page for users?
- Custom redirection when managing users in admin
- Different role for free and pro users in wordpress without using bbpress
- You do not have permission to access this document on form submit
- Add a user to edit the layout of a site
- Make A WordPress Page Accessible To Admins Only, Redirect Other User Roles
- localhost/wp-admin on my local redirects to production site’s /wp-admin
- How do I set up a webhook?
- How to retain HTML5 Attributes on Markup
- Replacing select2 in admin backend for all selects
- Gallery Settings Change available Columns
- Dynamically Set WordPress Post Title To The Category Name
- How to find out if an wp-admin action edited a file?
- Text snippets shared across posts
- How to detect first visit of a user?
- Add number new posts (post_status = pending) to administration menu [duplicate]
- Allow role to delete posts but block him the wp-admin
- I keep getting logged out in Firefox
- Need help cleaning up a wordpress site after being hacked
- Showing Post Counts of One’s (Author) Own in the admin post list
- Fallback media image for featured image not working in admin column
- When admin changes a password for a registered user, I don’t want to send a password change email to users
- How do you handle postmeta in admin area?
- Admin – Load existing admin template as a submenu page
- Admin interface problems – thickbox? jquery?
- Restricting access to a single MultiSite site based on IP — possible?
- admin : search custom fields
- Filter out other users comments. Visualize only own comments and editor role users’ comments
- Move ‘current-menu-item’ class on #adminmenu li from Posts to Pages for Taxonomy Edit Screen
- Admin cannot publish
- Activate Gallery Options in Media Uploader for Custom Usage
- How Can I Found Admin Directory
- Problem with Settings API: changes are not saved after submit
- Best way to tell if a comment is from a user?
- WordPress Home/Front Page Display at top of Admin Pages List
- /wp-admin/install.php redirecting to 123-reg
- Admin Panel Development [closed]
- Logout Redirect and also WP-login.php Redirect
- Why does Thickbox jQuery load on my site?
- call wp_insert_user in custom class doesnt work
- Custom Jquery in admin breaks media-upload script
- referencing the current user in a page i created in wordpress
- Change wordpress’ database data using ajax – how to get current user id?
- How to show WordPress admin dashboard forms on front-end?
- get_current_user_id() always return 0 in if else statement
- WordPress – add help text under category list(right side) in post edit page
- Cannot access wp-admin after installing SSL – user capabilities not being set
- WordPress4.1.15 Dashboard links not working
- Admins loggin in to our wordpress site default to the admin page
- ‘Conflict’ with action deleted_post and is_admin()
- Dropdown list of available posts for post editing
- Add Sort Link in Custom Post Type List
- local WAMP admin user has lost privileges
- Create users via PHP
- WordPress 4.5 Inline Link Toolbar not working on custom wp_editor instance
- Cant enter admin page with SSL
- AJAX call not initializing for non-admins in WordPress