October 2018
Beginner
300 pages
8h 34m
English
We have to build a custom route to manage the login and registration of the site. Now we need to access the custom query variable from the custom route and generate the screens for login and registration. Consider the following code for the implementation of login and registration forms:
add_action( 'template_redirect', 'wqraf_front_controller' );function wqraf_front_controller() { global $wp_query; $wpquick_action = isset ( $wp_query->query_vars['wpquick_action'] ) ? $wp_query->query_vars['wpquick_action'] : ''; switch ( $wpquick_action ) { case 'register': echo "<h1>REgistration Form</h1>";exit; break; case 'login': echo "<h1>Login Form</h1>";exit; break; }}
WordPress executes the template_redirect
Read now
Unlock full access