You can use wp_signon function
Here is an example
$creds = array();
$creds['user_login'] = 'example';
$creds['user_password'] = 'plaintextpw';
$creds['remember'] = true;
$user = wp_signon( $creds, false );
if ( is_wp_error($user) )
echo $user->get_error_message();
Related Posts:
- Select Query demand excesive resources [closed]
- Nested select statements not working
- How to display SQL query that ran in query?
- Get all image from single page using this query
- Add multiple value to a query variable in WordPress
- How to tune search argument in WP_Query to show only exactly the same results?
- Very slow query
- Search Terms – Querying on either description__like OR name__like in the same Term Query?
- Count user posts by user ID, Post type and Post status
- How to get category link without a database query
- search through post-type attachments titles
- cron job to auto delete posts of a specific post type older than x days
- get post id using the $query_vars variable
- Most effective use of DB querys
- mysql query paging
- Is there a conditional tag for latest post or do i need a query?
- Two differents queries in archive page
- How do I find if a page has a template?
- get_posts() loop returns the same the_title() for each post
- How to set back query var author_name after unset it?
- My SQL function to change user_name
- How select a specific query when setting offset?
- Change media attachment author via mysql query
- Temporarily storing main search result
- Help with MySQL to $WPDB query
- Ordering by a metadata subfield in WordPress?
- sql select query in wordpress ‘page’ [closed]
- wpdb->term_taxonomy count posts from both published and private posts?
- Query based on title, with ‘compare’ => ‘IN’
- Issue with using add_rewrite_rule() for post querying custom fields
- Group custom post listing in admin section
- Plugin will sort users by usermeta
- problem with sql query in wordpress plugin
- Attempt to improve WP search, can someone check my SQL query?
- Searching With Apostrophe
- Multiple Category Query
- list all categories that have a certain word in title
- Passing parameters to a static front page
- wp_list_pages() refuses to output posts
- List author’s posts with SQL
- Where is the query in wp-login.php
- Can’t seem to do combined query AND sort?
- Order posts by recent comments
- query if page has not child
- sort query results by newest
- How to reset usual $query on search page to push custom $wpdb query there?
- Order by meta value pro first then meta value free in my search function
- Order by title – but now built in wordpress func, sort the_title
- pre saved posts query from db options table
- Custom Query returns array, but I can’t see it’s elements
- How to delete all posts, categories and tags from WordPress database
- Ideas how to search & replace post_content when string contains a newline?
- How to insert Collate into WordPress search query?
- Combine “Exclude” Query in functions.php
- Query the WordPress database to get data together with replaced information
- $wpdb->prepare affecting the query?
- WordPress SQL search, how to handle SQL Injection?
- Optimize slow SQL query for multiple meta values
- prepare function sql safe method
- Display posts by combining multiple meta key
- Query for Custom Post Type UI Does Not Loop All the Post
- Custom select query two tables by a meta key
- Updating with $qpdb->query() always returns 0 rows affected
- How to manage a particular “order by” for get_search_query()?
- Query to view scheduled or draft post
- How to return count of custom post type posts with a specific custom field value via $wpdb?
- Help with Related Posts Function
- Trying to use WP_Query to return post with and without meta values
- How to add a Variable to post query
- Sort a list of a CPT ( job) if a meta is empty
- How to delete all images from code in all post_content
- Restrict WordPress search to a single ACF field
- SQL query to delete users with multiple meta keys and comments
- Restore WordPress Backup Locally?
- Trouble migrating custom post types from non-wordpress cms
- “order” does not affect order of custom query
- Create a new post on a specified publish date via link?
- Exclude Posts from a Widget
- New custom post type entries are not sorted correctly in admin using pre_get_posts
- Query String for the WP_QUERY parameters
- $wpdb query for price in custom field value
- Run an update query in a function
- Add generic page to WP_Query
- Advanced Custom Fields Query with Different Values of the Same Key
- No results for taxonomy archive page
- Multiple terms not working on taxonomy
- Sorting of coupons in the right way
- excludeCat function reverses order of blog posts
- Slow query when joining wp_posts with a lookup-table?
- Run search query again without pagination gives no results?
- Filter the feed page post limit
- Mysql query and odd results
- Using wp_list_table how to trigger update function “inline”?
- Filter multiple different main queries on custom pages
- WP_Query orderby meta key/value suddely stopped working
- WP_Query older new links navigation?
- Where can I find the SQL to get the most used information by wordpress database?
- WooCommerce Total # orders [closed]
- How to show sticky posts on all pages of the pagination, not just the first page?
- Help with query