How to redirect new registrars to a custom registration page instead of WP default registration page?

Since wp-login.php control both login and registration, it is better to redirect the visitor to a login page from wp-login.php. You can use this code for redirecting your registration page – add_action(‘init’,’custom_registration_page’); function custom_registration_page() { $new_registration_page_url = home_url( ‘/register/’ ); global $pagenow; if( $pagenow == “wp-login.php?action=register” && $_SERVER[‘REQUEST_METHOD’] == ‘GET’) { wp_redirect($new_registration_page_url); exit; } } … Read more

bundled jquery in theme js not working with wp_localize_script

You can’t use wp_localize_script with jquery. this function use the WP_Scripts::localize() function which have a condition right in the start. You can see it in the file \wp-includes\class.wp-scripts.php line 414 if ( $handle === ‘jquery’ ) $handle=”jquery-core”; You can do something else like add the script with other action like wp_head if your script is … Read more

When to use wp_register_script() function?

I have gone through some articles and come to the following conclusion. I think it helps. Registering any scripts using wp_register_script() is just registering; not loading it. The registered script will not be loaded until it is enqueued using wp_enqueue_script(). We don’t need to register and enqueue each of the scripts simultaneously. We should just … Read more

Plugin Activation Causes wp_register errors

The warning is self-explanatory: Notice: wp_register_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. You have to call wp_register_style on the correct hooks: wp_enqueue_scripts for the frontend admin_enqueue_scripts for the backend login_enqueue_scripts for the login page Calling wp_register_script on any other hook, or no … Read more