- Hashing passwords
- Comments template
- Compiler vs Transpiler
- HMR
How WordPress Stores Passwords?
WordPress uses hashing and salting to save the passwords in the database, When we enter the password at auth it is again hashed and salted using the same algorithm used before and then compared with the one in DB
WordPress provides function wp_hash_password(), it takes a string password as input and returns the hashed value.
$my_pass = 'very-secret-password';
wp_hash_password( $my_pass );
WordPress has a function to check the password : wp_check_password()
Loading the comments template
The function comments_template(); can be used to load the comments template, but where to put the comments.php?
We can put it anywhere, just have to give the file path as a parameter to the function, by default it will check for comments.php in the theme root.
comments_template('/template/comments.php');
Compiler Vs Transpiler
A compiler is a tool used to translate high-level language code to low-level language code, like from cpp to machine code
Transpiler translates the code from one high-level language to another high-level language
So the Babel tool must be a transpiler, then why on the official site do they say it is a compiler and not a transpiler? 🤨
Setting the Hot Module Replacement in WebPack dev server
First, in the configuration, we have to enable the HMR or do we?
The HMR is enabled by default for the latest versions of webpack dev server, but if it is not we can enable using this configuration
const path = require('path');
module.exports = {
entry: {
index: './src/index.js',
},
devServer: {
static: './dist',
hot: true,
},
output: {
path: path.resolve(__dirname, 'dist') ,
filename: '[name].js',
},
mode : 'development',
}
then run the server using
% npx webpack-dev-server --hot
If it is still reloading and HMR is not working, you may need to put below code at the top of your entry point.
if (module.hot) {
module.hot.accept();
}
References that I refered to learn today:-
- https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
- https://www.anthonysteele.co.uk/TheSingleReturnLaw.html
- https://youmightnotneedjquery.com/
- https://wordpress.tv/2017/06/22/alain-schlesser-demystifying-the-wordpress-bootstrap-process/
Leave a Reply