• Resolved Juliane

    (@juliane16)


    Hi,

    I use Forminator to display a simple form to create posts. When submitting the form, could the user be redirected to his created post? The only option I find is redirecting to a single URL.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @juliane16,

    Trust you are doing good and thank you for reaching out to us.

    I have pinged our developers to see if a quick workaround could be provided for this and we’ll update you once we have more feedback as soon as possible.

    Kind Regards,
    Nebu John

    Thread Starter Juliane

    (@juliane16)

    Thanks! I’ll wait then.

    Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi again,

    Please try adding the following snippet using a mu-plugin.

    <?php
    add_action( 'forminator_post_data_field_post_saved', function( $post_id ){
    	$GLOBALS['forminator_post_id'] = $post_id;
    
    	add_filter( 'forminator_replace_form_data', function( $content, $data, $fields ){
    		if( ! empty( $GLOBALS['forminator_post_id'] ) && false !== strpos( $content, '{post_url}' ) ){
    			$content = str_replace( '{post_url}', get_permalink( $GLOBALS['forminator_post_id'] ), $content );
    		}
    		return $content;
    	}, 10, 3 );
    } );

    Please use {post_url} in the after-submission behaviour as in the following screenshot: https://ibb.co/jZsybN5

    Please find how to install a mu-plugin here: https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    Kind Regards,
    Nebu John

    Thread Starter Juliane

    (@juliane16)

    Hi,

    Thanks! It works just fine.

    I mark this as resolved.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Redirection after form submission’ is closed to new replies.