That function should do what you want. Are you sure the error is not elsewhere?
You can also try using the get_user_by()
(source) function:
$user = get_user_by('login', 'MaryJane');
This is the same as get_userdatabylogin('MaryJane');
Related Posts:
- How to check username/password without signing in the user
- Add Custom User Capabilities Before or After the Custom User Role has Been Added?
- WordPress REST API call generates nonce twice on every call
- Custom user profile, registration, login page with theme
- How to use WP default post list tables in a plugin?
- How to add quick edit and bulk edit fields to users admin section
- Generating User(s) with Settings API
- WordPress admin deleted user details not removed in database. How to delete WordPress Users from Database
- Print WordPress username id inside JavaScript
- Check if someone is editing a post (this content is currently locked)
- Modify users.php page to create page/post on button clicked
- Subscribe to author?
- How to filter users list on user_status field with get_users()
- Frontend language per user
- Display custom fields in frontside user profile
- global $current_user not current user
- Display list of uploaded images, filtered by user under a specific user group
- What is the proper way to get logged in user id in a plugin?
- How to build a fool proof AdSense revenue sharing model?
- Hide custom post type by user roles
- How do I have now a duplicated user entry if this is not allowed (and I cannot replicate it)?
- How to allow only two (or more) users access to a plugin
- First and last name fields not filled when using wp_insert_user
- Wp-admin Custom User Management
- get author of published post
- How to get custom post_author?
- Associate multiple email addresses with the same user account, so they can log in with either
- Update a user profile via frontend
- Best practice for Designing a Plugin with this scenario
- Adding another field to user table
- how to get the top 10 popular blogs
- How can I change my assigned user role in WordPress 3.5.1?
- How to relate the Category to user?
- Adding a dropdown on the user admin
- Allowing duplicating users with same user_login and user_email
- Why User_login key doesn’t work with wp_update_user()
- How to grab data after wp user search is complete
- How to prevent users from deleting their accounts?
- User Registration Moderate
- How to retrieve custom profile fields associated with different users
- Upgrade routine: Interaction with user confirmation
- Multiple Users Logged In Causing Incorrect Account Returned
- first_name property missing inside register_user action hook
- user can login from single account detail from multiple locations(computer) at the same time [closed]
- Create Unique and Customized User ID for Website Members in WordPress
- How do I create a custom role capability?
- What is the advantage of using wp_mail?
- Calling the widget id of a mult-instance widget from inside the widget?
- Do I need to call do_action in my plugin?
- Fatal error: Call to undefined function wp_mail()
- Does WordPress have an Browser Agent?
- WooCommerce get Shipping Class of product from either the product id or the order after order is completed
- Dequeue script, but still use wp_localize_script to pass vars
- I can’t find where a hook is being defined in a plugin – Easy Digital Downloads
- Filter on the_content ignores shortcodes
- Replacing WordPress menu functionality with a plugin
- Is it possible to load plugin from console with core ?
- Plugin base URL
- Database for development
- Customize multisite site creation with user data
- Where to call wp_enqueue_script in a plugin with custom template?
- How to prevent UNDO on guternberg block editor
- do_action and add_action on two different installed plugins won’t work
- How to override gutenberg paragraph block edit property
- How can I get the selected string when using a toolbar button in Gutenberg?
- Authorizing a plugin to call Google Analytics v4 API on wp_cron
- WordPress pre_get_posts with combined results of two queries (OR)
- Plugin directory says that my plugin it’s not availabe in Spanish, but it is
- how to use shortinit in wordpress
- Using ob_get_content to get_search_form puts into infinite loop
- Alternatives to DISALLOW_FILE_EDIT wp-config Constant? It Breaks Some Plugins
- Declare plugin dependency [duplicate]
- Warning: call_user_func_array() expects parameter 1 to be a valid callback
- Is there an admin hook that will let me read GET variable before it’s too late to set the header Location
- WordPress plugin development OOP style
- Let plugin check if taxonomy is already registered by another plugin
- How to add custom post widgets as tags into wordpress
- Submit form to a different PHP file in the same plugin folder
- What might be the reason of Couldn’t fetch mysqli_result on another domain?
- wp_insert_post generated mixed permalinks
- Adjust query on single
- Is there any way to pass messages from a script to a redirect target in a hidden fashion?
- What should I pass for $needed_dirs when calling _unzip_file_pclzip (aka PclZip)?
- Custom Path for a Plugin
- Plugin could not be activated because it triggered a fatal error?
- How to determine primary editor for a page/post
- Trigger function on Remove block or add new block in Gutenberg JavaScript
- WPGut – Updating failed and shortcode?
- How the add_action is included in the plugin development
- do I need to sanitize a shortcode’s function input?
- Email content as comment
- WordPress use template
- Warning: Illegal string offset – on homepage
- Organising and completing posts (mark as read and hide)
- Query only title/field/featured media of posts [closed]
- To remove rendering of menus and header, plugin or theme?
- Displaying External Data – Not Posts
- I want to add post meta for picture thum during submit for revision
- How to synchronize an e-commerce site and a pharmacy management software?
- woocommerce features to add product along with link