If you want current user id only then use get_current_user_id.
because it reduce execution time. get_current_user_id get only current user id where wp_get_current_user get all user data.
Else every things is perfect.
$user_id = get_current_user_id();
$loc_statuss = $wpdb->get_row( "SELECT status FROM profile_location INNER JOIN relation_user ON profile_location.loc_id=relation_user.loc_id WHERE relation_user.user_id=".$user_id );
$loc_status = $loc_statuss->status;
Related Posts:
- Is there a way (plugin?) to restrict a user to being able to edit just one page?
- WP_User_Query and non-unique usermeta data
- Where the Nickname is being used in WordPress
- Keep one user logged for a year?
- User-Specific Timezones? Hack? Plugin?
- Loading posts associated only to the logged in user on recent posts page
- How can i force Display names to be the same as Usernames?
- Removing user contact methods works from functions.php but not from a plugin
- $current_user var returns NULL
- Multisite functions to communicate with individual site functions
- Is it possible to block subscriber users to changing its password?
- WordPress Plugin for One-Time Event Registration? [closed]
- Will WordPress username displayed somewhere in the site?
- Removing WordPress Plugin Menu Item for a specific user
- Upload files programmatically to users
- How to expire all wordpress user passwords instantly?
- How to show popup to a group of users?
- Current user in plugin returns NULL
- update_user_meta add value on the top on existing value
- Reset WordPress website
- Two people sharing user in WordPress [closed]
- How to upload user profile image from frontend in wordpress ?
- How to transfer all user data between wordpress installations?
- Getting user roles in plugin files
- Auto delete WordPress users according to time
- How to associate more than one user to a post?
- Average Account Age
- How to keep users unique id stored in session in addition to IP in WordPress plugin?
- How to get current post user id
- How to create user groups and allow custom posts and plugin modify/access to specific group?
- New User Form – Custom Menu Page
- wp_set_auth_cookie causes 403 error in the wooCommerce checkout
- How can I copy all users to newly created site on a multisite network in WordPress?
- How to create restrict content to users (by user, not by role)
- Enable users to change change and add taxonomies of posts
- How can I change the meta_key for a particular piece of information?
- Custom User meta field display
- edit_user_profile and show_user_profile are not firing inside a class
- How to create multiple users at once?
- Shortcode to update user meta
- Multisite – maximum number of users with specific role
- How do I get the user ID of the user that was updated in WordPress?
- How to have sample page for each new register users in a membership website
- How to get all posts belongs to a user between a certain date
- Specific way to allow WordPress users to view their current password? And edit it?
- how can I query all wordpress users of a blog
- Is there a plugin for WordPress for creating ‘Accounts’ where all users who belong to that Account can only see Account data? [closed]
- get_users(); Is an Undefined Function When Used in Cron Job
- How limit user connection?
- Custom Login page with custom redirects for each user?
- how to make dynamic subdomain for each user registering?
- How to pass a query string to another page on the same site?
- Mutliple users editing single document in wordspress
- Remove specific administrator’s capability
- Personalized Author Area
- How to auto strip hyperlinks & images in wordpress post
- Completely remove ability to create users?
- Creating teams of users in WordPress
- WordPress plugin for Limited days user
- Plugin privelages for “editors”
- Shortcode not displaying HTML within the function
- Can’t save changes or modify settings in Dashboard but Pages and Posts are fine
- Disable Author Archive just for certain roles in bulk
- Auto populate a user custom field from another user custom field
- Can we hide a certain user in WP?
- How to implement data residency in my WordPress site
- how to create user profile pages and display them based on users roles
- Clean old users
- After reading 3 story by user ask for subscription popup
- User updating their profile wipes my custom fields
- Comment restrictions Wodpress
- How To Export User’s Custom Fields in CSV or XLSX
- Get all user meta_keys and then group users by matching values
- On button click, redirect users to registration page instead of another page
- Searchable Semi Random Number Generator on User Profiles
- How do I run my custom function in my plugin when a wordpress user is deleted?
- How can I store user preferences in WordPress and retreive them later?
- Simulate Update User button click
- Update User Meta Via Ajax
- User Following System
- User / membership Plugin [closed]
- How to see in Edit Comments if comment is from User and her Roles
- Custom User Notice Upon Login
- How can I save cookies to members
- Paid Memberships Pro, Display User Limit
- Confusing problem with displaying message recipient metadata
- Every time I use wp_get_current_user() my plugin breaks
- How to order users alphabetically by name? in plugin UPME
- Users Ultra: Hide asterisk for required registration fields?
- Defined user role to access plugin’s pages
- How change menu for each user in plugin?
- How to set different users for different pages?
- Want to add post to user dashboard
- User register hook can’t access form request
- How to make wordpress backend mobile optimized.?
- How to give different user access to different people?
- how to embed a crop feature for cropping images uploaded by the user
- How to give access to the particular page in wordpress for specific username/email NOT roles [closed]
- Share or sync user table data with another user table
- Issues with creating user profile for a subscriber, but with different profile page and functionalities