Hello.
1year ago I did ask this issue.
“At the moment, the plugin does not support redirecting into another page when other users open the private question as you mentioned here. However, we have sent and notified to our technical team about this issue, we will check and add an option to the next version.”
Is it possible now? Or please let me know what to do.
thanks!
1 Answers
Hi,
About this issue, you can add the following code to the functions.php file to redirect the user to the page that you want.
function redirect_to_login() {
global $wp_query,$wpdb;
if (is_404()) {
$private = $wpdb->get_row($wp_query->request);
if( 'private' == $private->post_status ) {
wp_safe_redirect(home_url('your-slug-page'));
die;
}
}
}
add_action('template_redirect', 'redirect_to_login');
Please login or Register to submit your answer