Milad Nekofar
asked 8 years ago

There is a problem related to the submit of new questions on our website. We use manual question approve, and sometimes users keep sending questions, again and again, because they don’t understand, that question already sent. I wanted to know if is there any way to redirect users to the list of questions instead of turn back them to the submit form.

2 Answers
Kevin
answered 8 years ago

Hi,

You can add the code below to wp-content/plugins/dw-question-answer/inc/Handle.php at the line 444 below the code dwqa_add_notice( __( 'Your question is awaiting moderation.', 'dwqa' ), 'success' );

$dwqa_options = get_option( 'dwqa_options', array() );
$redirect = home_url();
if ( isset( $dwqa_options['pages']['archive-question'] ) ) {
	$redriect = get_permalink( $dwqa_options['pages']['archive-question'] );
}
exit( wp_safe_redirect( $url ) );
Milad Nekofar
replied 8 years ago

Hi dear Kevin, and thank you. But is that a permanent solution? I guess this code will be overwritten after upgrade to new version.

Kevin
answered 8 years ago

Hi,

You can replace the code I gave you with the code below

do_action( 'dwqa_after_insert_question_all_done', $new_question );

Then add the code below to wp-content/themes/your-theme-folder/functions.php

add_action( 'dwqa_after_insert_question_all_done', 'dwqa_theme_redirect_after_insert_question' );
function dwqa_theme_redirect_after_insert_question() {
	$dwqa_options = get_option( 'dwqa_options', array() );
	$redirect = home_url();
	if ( isset( $dwqa_options['pages']['archive-question'] ) ) {
		$redriect = get_permalink( $dwqa_options['pages']['archive-question'] );
	}
	exit( wp_safe_redirect( $url ) );
}
Powered by DW Question & Answer Pro