I'm new to WordPress and am not understanding their docs. What I'd like to do is to replace the wp_hash_password (and a few other password related functions) with my own. I've already written the functions and had them tested outside WordPress to ensure functionality.

"wp_hash_password function can be replaced via plugins. If plugins do not redefine these functions, then this will be used instead."

According to WordPress docs

Unfortunately I can't find any place that tells me HOW to do it. I tried creating a PHP file in the ../wp-content/plugins/myfirstplugin/myplugin.php. In my myplugin.php file I have an "overriding" function:

function wp_hash_password( $password ) {

 // my code is here


I also tried renaming my php file to functions.php and even used the add_action & add_filter but again the docs are less than supportive.

I have the code I just need to know how to put it in a "plugin", where the plugin goes, and how to activate the plugin (is this done in the wordpress admin's menu?)



You're on the right track with creating the plugin. All your assumptions are correct.

To avoid errors on activation you'll want to wrap the functions that you are redefining in function_exists blocks, as on activation those functions will already be defined:

if ( ! function_exists( 'wp_hash_password' ) ) :

function wp_hash_password( $password ) {
    return 'foo';


Put your code in wp-content/plugins/myfirstplugin/myplugin.php make sure the plugin has the file headers so WordPress knows it is a plugin. There is also some helpful information for this on the Writing a plugin page under the heading Standard Plugin information

Then as you already assumed you activate your plugin on the plugins page in the WordPress admin.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.