How to redirect to custom URL after submitting a question?

3.64K viewsGeneral
0

Hi Rauhl,
I’m running a moderated setup of Anspress an would like to redirect the user to a custom URL (i.e: domain.com/thank-you-for-asking/) after question submission but can’t find anything here…Is there a way to achieve this?
Thanks,
Andre

Answered question
1

Hi Andre,
You can use action ap_after_question_form_processed.

add_action( 'ap_after_question_form_processed', function () {
    ap_ajax_json(
        array(
            'success'  => true,
            'redirect' => get_permalink( $post_id ), // CHANGE THIS TO CUSTOM LINK
        )
    );
});

Edited answer
You are viewing 1 out of 1 answers, click here to view all answers.