Generate WordPress salt

Does WordPress core has this function defined somewhere?

While I haven’t used it, you are probably looking for wp_salt or wp_generate_password. wp_salt is located in wp-includes/pluggable.php.

can these salts be generated randomly

Yes, of course.

are there any specific rules for creating them

There is no specific rule. The generic rule is to create long, random and complicated password. By default, WordPress generates them using wp_generate_password (wp_generate_password (64, true, true)). This function accepts three parameters (all are optional). The first param is the length (default value is 12), the second is to use standard special characters (boolean value, default is true), and the third is to use other special characters (boolean value, default is false).

Leave a Comment