Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter agnishghatak

    (@agnishghatak)

    Not sure why it’s happening but resolved it with preg_replace ?? ..

    • This reply was modified 2 years, 2 months ago by agnishghatak.
    Thread Starter agnishghatak

    (@agnishghatak)

    add_action( 'forminator_post_data_field_post_saved', function( $post_id ){
    	$_POST['forminator_post_id'] = $post_id;
    	add_filter( 'forminator_replace_form_data', function( $content, $data, $fields ){
    		if( ! empty( $_POST['forminator_post_id'] ) && false !== strpos( $content, '[post_url]' ) ){		
    			$link = preg_replace('#^https?://#i', '', get_permalink( $_POST['forminator_post_id'] ));
    			$content = str_replace( '[post_url]', $link, $content );
    		}
    		return $content;
    	}, 10, 3 );
    } );
    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @agnishghatak

    I hope you’re well today!

    I’m sorry for late response but I’m happy that you managed to find solution and thank you for sharing it with us. I’m sure somebody will find it useful!

    Best regards,
    Adam

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Redirect to New Post’ is closed to new replies.