Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Justin Sternberg

    (@jtsternberg)

    You can modify the redirect location (https://github.com/WebDevStudios/CMB2-Snippet-Library/blob/master/front-end/cmb2-front-end-submit.php#L232) to something like:

    wp_redirect( esc_url_raw( add_query_arg( 'post_submitted', $new_submission_id, site_url( 'success' ) ) );

    And then on that other page, you would want to do your handling for the success message: https://github.com/WebDevStudios/CMB2-Snippet-Library/blob/master/front-end/cmb2-front-end-submit.php#L124-L134

    Thread Starter bigevent

    (@bigevent)

    Thank you for your quick reply. I am trying to redirect to the address like below

    http://www.domain.com/submitted

    And I updated the redirect line like this below.

    wp_redirect( esc_url_raw( add_query_arg( 'submitted', '' ) ) );

    And it leads me to the address below.

    http://www.domain.com/?submitted

    How can I get rid of ? symbol.

    Thank you for your help and teaching.

    Jo

    Thread Starter bigevent

    (@bigevent)

    Maybe I should explain to you why I am trying to do this.

    All post created by guest with front end form will be private. So I don’t want people to guess the other post with the post ID number. So I want to hide the post number in the address at the page for confirmation. But I guess you cannot hide them because you need it to get information of the author name to show in the confirmation page. So my idea is the create a generic page and I am trying to redirect to this page when guest finish submission.

    Thanks.

    Jo

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    If I were trying to do what you were, and was using Justin’s examples above, I’d amend the wp_redirect() to use just the permalink of the /submitted/ page, so that it drops the user there.

    I’d also have a custom php template for that page specifically, so that there’s a central place where I could have any final form handling after the redirect.

    Instead of:

    wp_redirect( esc_url_raw( add_query_arg( 'submitted', '' ) ) );

    it’d be something like, except using the actual page ID for your site:

    wp_redirect( get_permalink( 2 ) );
    Thread Starter bigevent

    (@bigevent)

    It works. Thank you so much Michael.

    Jo

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘front end – moving to a certain web address after submission’ is closed to new replies.