I have created the following mu-plugin mu-plugins\post-registration-redirect.php
:
<?php
/*
Plugin Name: Post Registration Redirect
Description: Redirect non-admins to submit-place page after logging into the site.
*/
function submit_place_login_redirect( $redirect_to, $request, $user ) {
if ( !is_wp_error($user) ) {
return WP_HOME.'/submit-place/';
} else {
...
}
}
add_filter('login_redirect', 'submit_place_login_redirect', 10, 3);
/submit-place/
is a URL Slug of a WordPress page (the page displays a form to signed in users).
Question: what are the best options to replace hardcoded '/submit-place/'
with a variable?
My main concern:
If I update my WordPress Page slug to something like /new-place/
three months later my redirect will break and I won’t even notice it