{"id":15760,"date":"2020-11-11T17:00:34","date_gmt":"2020-11-11T16:00:34","guid":{"rendered":"https:\/\/qodeinteractive.com\/magazine\/?p=15760"},"modified":"2020-11-11T00:44:40","modified_gmt":"2020-11-10T23:44:40","slug":"wordpress-reset-admin-password-localhost","status":"publish","type":"post","link":"https:\/\/qodeinteractive.com\/magazine\/wordpress-reset-admin-password-localhost\/","title":{"rendered":"How to Reset WordPress Admin Password on Localhost"},"content":{"rendered":"<div class=\"wpb-content-wrapper\"><p>[vc_row][vc_column][vc_column_text]The term localhost indicates a local server, usually set up on your computer. WordPress website creators often opt for installing WordPress in a localhost environment as it offers various benefits. Those benefits include safely testing new plugins and themes, making sure the latest updates and newly created code won\u2019t cause errors, learning about WordPress, and many more. Experienced WordPress users can even create a website in a localhost environment and then migrate it to a live server. To install WordPress on localhost, you can use the <a href=\"https:\/\/qodeinteractive.com\/magazine\/install-wordpress-locally-with-xampp\/\">XAMPP<\/a>, <a href=\"https:\/\/qodeinteractive.com\/magazine\/install-wordpress-locally-on-mac-using-mamp\/\">MAMP<\/a>, or <a href=\"https:\/\/qodeinteractive.com\/magazine\/install-wordpress-on-wamp\/\">WAMP<\/a> applications.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]However, while working in the localhost, users sometimes forget their admin password which makes them unable to access the WordPress dashboard. Forgetting or losing a password can happen to anyone; and it happens often with localhost if you visit your website there infrequently. However, the trouble arises when the usual way of resetting an admin password\u2014password reset email\u2014isn\u2019t applicable. Precisely this is the case with the localhost. And that means users need to find an alternative way to reset their WordPress admin password. Luckily, we made a comprehensive guide explaining how to reset your WordPress admin password on localhost.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;80px&#8221;][vc_widget_sidebar sidebar_id=&#8221;new-top-picks-banner&#8221;][vc_empty_space height=&#8221;81px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">How to reset a WordPress admin password on localhost<\/h2>\n<p>[\/vc_column_text][vc_column_text]In this section, we will show you three different methods of resetting the WordPress admin password. <strong>Even though this article is intended for changing WordPress passwords while in the localhost, the methods described below can be applied to live WordPress websites as well.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]<strong>If you are trying to reset the password for a live website, you should first try using the <em>Lost your password?<\/em> link from the login screen. This will take you through resetting the password via email method.<\/strong> If that doesn\u2019t work, you can try one of the approaches described below. And, if you don\u2019t feel comfortable implementing these methods, try finding professional help to do it for you. With that being said, let us see the three ways you can use to reset your WordPress admin password on localhost.[\/vc_column_text][vc_empty_space height=&#8221;72px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\">How to reset a WordPress password from phpMyAdmin<\/h3>\n<p>[\/vc_column_text][vc_column_text]<a href=\"https:\/\/wordpress.org\/support\/article\/phpmyadmin\/\" target=\"_blank\" rel=\"noopener noreferrer\">PhpMyAdmin<\/a> is a popular, free, and open-source database administration tool for MySQL and MariaDB. <strong>All data belonging to a WordPress website, including passwords, is stored in appropriate tables within a given MySQL database.<\/strong> This means the fastest way of resetting the password is by directly changing its value in the database. We will show you two ways of doing so below.[\/vc_column_text][vc_empty_space height=&#8221;22px&#8221;]<ul class=\"qodef-unordered-list-item qodef-toc\">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\"><strong>Manually changing the password<\/strong><\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;28px&#8221;][vc_column_text]To manually change your WordPress admin password, <strong>insert<\/strong> <a href=\"http:\/\/localhost\/phpmyadmin\/\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/localhost\/phpmyadmin\/<\/a> <strong>into your browser\u2019s address bar<\/strong>, which will open the phpMyAdmin login screen. Then, <strong>log in to phpMyAdmin by entering your username and password<\/strong> and <strong>pressing the <em>Go<\/em> button<\/strong>.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"374\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin.jpg\" class=\"attachment-full size-full\" alt=\"phpMy Admin\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin.jpg 700w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-620x331.jpg 620w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]After that,<strong> find the database that your locally hosted website uses<\/strong> in the list of existing databases. Then <strong>click on it<\/strong> to see a list of available tables within. <strong>Locate the <em>wp_users<\/em> table<\/strong> and <strong>click on it,<\/strong> as well.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"374\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-2.jpg\" class=\"attachment-full size-full\" alt=\"phpMy Admin\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-2.jpg 700w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-2-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-2-620x331.jpg 620w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]<strong>If you aren\u2019t sure what your database name is or even what the credentials for logging into phpMyAdmin are, don\u2019t worry. You can find them by accessing the wp-config.php file. The wp-config.php file is located in your root WordPress directory<\/strong>. <strong>Find the file<\/strong> and <strong>open it<\/strong> using any text editor.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Within the file, <strong>find the following line,<\/strong> which should be near the top of the file:[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">define(\u2018DB_NAME\u2019, \u2018your_database_name\u2019);<\/pre>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]In practice, the <strong>your_database_name<\/strong> part will be replaced with an actual database name. In our example, visible on the screenshot below, the name of the database is <strong>test<\/strong>.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]After that,<strong> look for the <em>define( &#8216;DB_USER&#8217;, &#8216;your_username&#8217; )<\/em>; and <em>define( &#8216;DB_PASSWORD&#8217;, &#8216;your_password&#8217; );<\/em> lines of code to figure out the username and password.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"374\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/WP-Config-Code.jpg\" class=\"attachment-full size-full\" alt=\"WP Config Code\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/WP-Config-Code.jpg 700w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/WP-Config-Code-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/WP-Config-Code-620x331.jpg 620w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]<strong>After you find the necessary information from the wp-config.php file, proceed as described above<\/strong>. By clicking on the <em>wp_users<\/em> table to open it, you will see a list of all current users and their relevant data in the central section of the screen. <strong>Look within the user_login column to locate the exact user whose password you wish to change<\/strong>. Then,<strong> press the <em>Edit<\/em> button<\/strong> that is located within the same row as that user.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"374\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-3.jpg\" class=\"attachment-full size-full\" alt=\"phpMy Admin 3\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-3.jpg 700w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-3-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-3-620x331.jpg 620w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]If you weren\u2019t able to find the <em>wp_users<\/em> table, it is most likely that <a href=\"https:\/\/qodeinteractive.com\/magazine\/how-to-change-wordpress-database-prefix\/\">the default WordPress database prefix was changed<\/a> for security purposes. Instead of looking for <em>wp_users<\/em>, look for <em>prefix_users<\/em> (with the <em><strong>prefix<\/strong><\/em> part being replaced with an actual prefix). To give you a dummy example, the table might be called <em>qode_users<\/em>.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]After you click on the <em>Edit<\/em> button,<strong> locate the row containing the <em>user_pass<\/em> column label<\/strong>. Within that row, <strong>choose <em>MD5<\/em> as the function name<\/strong> and <strong>replace the current label found in the <em>Value<\/em> column with your new password<\/strong>. Afterward, <strong>press the <em>Go<\/em> button<\/strong> below.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"404\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-4.jpg\" class=\"attachment-full size-full\" alt=\"phpMy Admin\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-4.jpg 700w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-4-300x173.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-4-620x358.jpg 620w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]The processing time should be brief, so wait until you see a success message, stating that the password for the given user was changed.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"374\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-5.jpg\" class=\"attachment-full size-full\" alt=\"phpMy Admin 5\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-5.jpg 700w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-5-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-5-620x331.jpg 620w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/>                        <\/div>\n<\/div>[vc_empty_space]<ul class=\"qodef-unordered-list-item qodef-toc\">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\"><strong>Running an SQL query<\/strong><\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;28px&#8221;][vc_column_text]You can execute the same procedure as an SQL query. This method is more suitable for advanced WordPress users who are familiar with writing and executing queries. The benefit of this approach is that it is far quicker for resetting your password.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]From within phpMyAdmin, start by <strong>clicking on the database of your locally hosted website<\/strong> (in our case, the database is called <em>test<\/em>). Then <strong>click on the SQL tab<\/strong>, located near the top of the central section of your screen.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"374\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-6.jpg\" class=\"attachment-full size-full\" alt=\"phpMy Admin\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-6.jpg 700w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-6-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-6-620x331.jpg 620w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Then,<strong> insert the following query in the textarea<\/strong> at the top:[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">UPDATE `wp_users` SET `user_pass` = MD5( 'new-password' ) WHERE `wp_users`.`user_login` = 'username';<\/pre>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"374\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-7.jpg\" class=\"attachment-full size-full\" alt=\"phpMy Admin\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-7.jpg 700w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-7-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-7-620x331.jpg 620w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Make sure to insert an actual password instead of the <em><strong>new-password<\/strong><\/em> label, as well as your correct username instead of the <em><strong>username<\/strong><\/em> label. Also, <strong>if you have changed the default prefix of your database, replace the<em> wp_<\/em> part of the <em>wp_users<\/em> label with the appropriate prefix.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]<strong>We advise conducting a dry run of the query first by pressing the <em>Simulate query<\/em> button<\/strong>. That way, you will be able to see if the query is written properly or not. <strong>If you find a syntax error in the query, make sure to double-check the code and fix the error before pressing the <em>Go<\/em> button.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]After a fraction of a second, you should see a success message, stating that your query was run and it successfully affected 1 row. This means it changed the password for one user exactly.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"374\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-8.jpg\" class=\"attachment-full size-full\" alt=\"phpMy Admin\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-8.jpg 700w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-8-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/phpMy-Admin-8-620x331.jpg 620w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;82px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\">How to reset a WordPress password by editing the functions.php file<\/h3>\n<p>[\/vc_column_text][vc_column_text]<strong>You can also change the password of your main administrator user by inserting a small code snippet into the functions.php of the currently active theme.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]To do so, <strong>open the root WordPress directory of your locally hosted website<\/strong> and <strong>navigate to the \/wp-content\/themes\/ folder<\/strong>. <strong>Open the folder of the theme you are currently using, locate the functions.php file<\/strong> within, and <strong>open it<\/strong> using any text editor. <strong>Insert the following code<\/strong> at the end of the file:[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">wp_set_password( 'new_password', 1 );<\/pre>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Make sure you replace the <em><strong>new_password<\/strong><\/em> part with an actual password.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"374\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/Functions-Code.jpg\" class=\"attachment-full size-full\" alt=\"Functions Code\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/Functions-Code.jpg 700w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/Functions-Code-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/Functions-Code-620x331.jpg 620w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Then, <strong>save the changes you made to the file<\/strong> and <strong>try to log in to your admin dashboard<\/strong> using the main administrator username and the new password you just created.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"374\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/Login-WP.jpg\" class=\"attachment-full size-full\" alt=\"Login WP\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/Login-WP.jpg 700w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/Login-WP-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2020\/11\/Login-WP-620x331.jpg 620w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]<strong>After you log in, open the same functions.php file once more to erase the password reset code you added.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]<strong>If your first login attempt wasn&#8217;t successful, it&#8217;s likely you have something in the cache causing you trouble or you haven&#8217;t removed the password reset code you added. In that case, make sure to remove the code from the functions.php file and clear your cache. You can even wait a bit before trying to log in again.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]We\u2019re going to briefly explain the code and why leaving it within the functions.php file is harmful.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]<strong>The <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_set_password\/\" target=\"_blank\" rel=\"noopener noreferrer\">wp_set_password()<\/a> function lives up to its name\u2014it resets the password for a given user. This function accepts two parameters. The first is the new password and the second is the ID of the WordPress user.<\/strong> Therefore, by inserting <em>wp_set_password( &#8216;new_password&#8217;, 1 );<\/em> you will be changing the current password of the user whose ID is 1 (which is the main administrator user) to <strong>new_password<\/strong>.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]However, as the function page itself lists,<strong> this line of code is meant to be used only once since it could be harmful otherwise<\/strong>. As this code resets the password on every page load, it can cause an endless loop of password resets if left in the functions.php file. <strong>This is why you must remove it after changing the password, as mentioned in both possible outcomes above.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;68px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">Final Thoughts<\/h2>\n<p>[\/vc_column_text][vc_column_text]Having a localhost WordPress website can come in handy for learning or testing purposes. But, in the age of information overload, we tend to forget a lot of stuff. Unfortunately, can include our WordPress admin password, which leaves us unable to log in to our dashboard. To successfully overcome this problem, just closely follow the steps for any of the methods we outlined in this article. If you do so, you can reset the admin password for your localhost WordPress site quite painlessly. And, to avoid such issues from happening in the future, we suggest safely storing your WordPress credentials and keeping them at hand.<br \/>\n[\/vc_column_text][\/vc_column][\/vc_row]<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>If you&#8217;re stuck unable to access your local WordPress installation, you need to reset the admin password on localhost. Check out this article to see how.<\/p>\n","protected":false},"author":11229,"featured_media":15768,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[4,13],"class_list":["post-15760","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-tips","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts\/15760","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/users\/11229"}],"replies":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/comments?post=15760"}],"version-history":[{"count":0,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts\/15760\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/media\/15768"}],"wp:attachment":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/media?parent=15760"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/categories?post=15760"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/tags?post=15760"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}