WPUF Tip – Redirect after submission

I’ve been using WordPress User Frontend for a few days now to manage submissions here. One of the problems I had was that the form would redirect to the new post after submission. But as that submission was set to pending the users would get a no page found error and proceed to retry their submissions multiple times.  Hence the up to six identical posts being submitted by users. Below is a quick fix to the WordPress User Frontend Page Submit error issue and bit extra.

Add this piece of code to your functions.php to redirect user to submission page.

 

You can also redirect the user to a page or post by simply adding the page/post id to “$post->ID=X”, where “X” will be the page id.

 

You can find your page/post id by visiting the page/post page and hovering over the title or “edit”.

 

 

 

Enter your email address to subscribe to PH and receive notifications of new posts by email.

Join 461 other subscribers

Comments

  1. Prakash says

    hi ,
    Thanks for the code you have provided its working but instead of passing ID how can we pass the name of the page so that it will redirect by the name of the page

  2. Rishi says

    Thanks for the code here we are passing the page ID or post ID

    return get_permalink( $post->ID=X );

    Please suggest me the code for How to pass Pagename or postname instead of ID

  3. iwd says

    And what is about Redirect after post edit? I want to redirect the user to same page after editing or updating posts. Any tips?

  4. says

    THANK YOU! I have been searching the Internet for a solution. I was receiving an error, too. I suspected it was the pending set. Your code was easy to add and understand. Thanks again!

Leave a Reply