I am very new to wordpress and I don't know anything yet. I have a custom registration page which works well, but after registration doesn't do any thing and user has to manually go to his profile via menu on top of the page! I want to automatically redirect to his profile page after registration. how can i do that?

thank you

    <h3>ثبت نام</h3>

<form name="learn-press-register" action="" method="post">

    <ul class="form-fields">
                        <li class="form-field">
                <div class="rwmb-field rwmb-text-wrapper "><div class="rwmb-field rwmb-text-wrapper ">
                <label for="reg_username">نام کاربری</label>

            </div><div class="rwmb-field rwmb-text-wrapper "><input name="reg_username" class="rwmb-field rwmb-text-wrapper " id="reg_username" required="" type="text" size="30" placeholder="نام کاربری"></div><input class="rwmb-field rwmb-text-wrapper " type="hidden" value="reg_username"><div class="rwmb-field rwmb-text-wrapper "></div></div>                </li>
                        <li class="form-field">
                <div class="rwmb-field rwmb-email-wrapper "><div class="rwmb-field rwmb-email-wrapper ">
                <label for="reg_email">ایمیل</label>

            </div><div class="rwmb-field rwmb-email-wrapper "><input name="reg_email" class="rwmb-field rwmb-email-wrapper " id="reg_email" required="" type="email" size="30" placeholder="ایمیل"></div><input class="rwmb-field rwmb-email-wrapper " type="hidden" value="reg_email"><div class="rwmb-field rwmb-email-wrapper "></div></div>                </li>
                        <li class="form-field">
                <div class="rwmb-field rwmb-password-wrapper "><div class="rwmb-field rwmb-password-wrapper ">
                <label for="reg_password">کلمه عبور</label>

            </div><div class="rwmb-field rwmb-password-wrapper "><input name="reg_password" class="rwmb-field rwmb-password-wrapper " id="reg_password" required="" type="password" size="30" placeholder="کلمه عبور"><p class="description" id="reg_password-description">رمز عبور باید حداقل 12 حرف باشد سمبلهای مقابل استفاده کنید ! " ? $ % ^ &amp; )</p></div><input class="rwmb-field rwmb-password-wrapper " type="hidden" value="reg_password"><div class="rwmb-field rwmb-password-wrapper "></div></div>                </li>

        <input name="learn-press-register-nonce" id="learn-press-register-nonce" type="hidden" value="6c324d4ef8"><input name="_wp_http_referer" type="hidden" value="/%D9%BE%D8%B1%D9%88%D9%81%D8%A7%DB%8C%D9%84-%D9%85%D9%86/">     
   <button type="submit">ثبت نام</button>




You have to use the registration_redirect hook, add this into your theme's functions.php

function wpse_registration_redirect() {
    return home_url( '/page' );

add_filter( 'registration_redirect', 'wpse_registration_redirect' );
| improve this answer | |
  • 1
    Note that add_filter are great ways to modify how WP works. As a person new to WP, and if you are interested in modifying how things work in WP, start here: developer.wordpress.org/reference/functions/add_filter . As to which filter to look at, you can usually get a hint by looking at the code that runs a particular page. Another place to learn about filters: docs.presscustomizr.com/article/… . Many choices if you ask the googles. – Rick Hellewell Aug 20 '18 at 22:45
  • Indeed Rick, cool resource. – Castiblanco Aug 20 '18 at 22:46
  • Thank you, but I don't know why non of these filters do not work out! – zaf y Aug 20 '18 at 22:59
  • Deactivate all the plugins and check again, if it works, it is a plugin that is blocking it by mistake, if you find the plugin and it's really important and cannot be replace it, show us the code of your custom registration page so we can find a work around. – Castiblanco Aug 20 '18 at 23:04
  • Depends on where you are putting your code. It needs to be in functions.php file. Best to put it in a Child Theme, as putting it in the current theme's folder will cause your changes to go away on a theme update. So: use a Child Theme, put your function in the function.php in your Child Theme folder, then activate the Child Theme. If you are not using a Child Theme, you should: codex.wordpress.org/Child_Themes . You could also put it in your own plugin, but that's a bit more advanced. For leaning: look in the Codex for how templates work, and more. Lots of good info there to help. – Rick Hellewell Aug 20 '18 at 23:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.