When I'm changing the password from front side profile change functionality using "Profile Builder" plugin. Manually i add the logout functionality like below :
Logout
Then it asking confirmation that you really wants to logged out.
I don't want that confirmation, because it redirects to wp-admin for confimation.
Any way to forcefully logged out from front in wordpress.
You can activate the plugin and add the following code to functions.php
add_action( 'wp_logout', 'auto_redirect_after_logout' );
function auto_redirect_after_logout(){
wp_redirect( home_url() );
exit();
}
Change your link code to
Logout
Related
Currently, when I log in to WordPress it takes me to my account page, but instead, I'd like people who log in to be sent to the website, not their account page. Is there a way to set this up?
I am not a wordpress developer but doing a little more looking I devised my own solution by adding the following to my functions.php file..
add_action('wp_login','auto_redirect_after_login');
function auto_redirect_after_login(){
wp_redirect( home_url() );
exit();
}
Works perfectly.
I am trying to disable the Woocommerce Setup Wizard but not having any luck. On a WP MU install it asks users to install plugins which is not possible for subsites. And then it asks admins to choose a theme that’s located on wordpress.org so that installation is not possible either. I need to disable this wizard. I am using the code below but it does not work. I am still being redirected to the setup wizard when I go to Woocommerce>Dashboard.
add_filter( 'woocommerce_enable_setup_wizard', 'disable_wizard' );
function disable_wizard(){
return false;
}
This should prevent the wizard from triggering:
add_filter( 'woocommerce_prevent_automatic_wizard_redirect', '__return_true' );
If you want to allow WooCommerce to trigger the wizard later, you can enable it again:
add_filter( 'woocommerce_prevent_automatic_wizard_redirect', '__return_false' );
I am having very weird issue in my store. I get redirected to woocommerce setup wizard page when I try to open any page in admin panel.
I tried setting up woocommerce settings. I have gone through all the steps and at last I again get redurected to setup wizard.
when I deactivate woocommerce plugin it runs properly. But with woocommerce pplugin it redirects to woo setup wizard.
I found the tie breaking solution guys. It was like stuck on the same page.
I got a filter from woocommerce docs.
add_filter( 'woocommerce_prevent_automatic_wizard_redirect', 'wc_subscriber_auto_redirect', 20, 1 );
function wc_subscriber_auto_redirect( $boolean ) {
return true;
}
This stopped the redirection from admin panel to wc setup wizard.
There is few options why this might happen, but probalby Your browser do cache wp-admin panel url with WOO wizard redirection.
Frist try solution: Delete browser cache.
This is what I use to prevent redirection
add_filter( 'woocommerce_prevent_automatic_wizard_redirect', '__return_true' );
I want to give some tips to the people that install my plugins. So after the installation of the plugin I want them to see an instruccion page, or go directly to the configuration of the plugin.
Any hook after the activation of the plugin where I can redirect to a page ?
I could use some flash message too for the same goal.
The register_activation_hook function registers a plugin function to be run when the plugin is activated.
register_activation_hook(__FILE__, 'redirect_to_instruction_page');
function redirect_to_instruction_page(){
wp_redirect( admin_url( 'admin.php?page=instructions' ) );
exit;
}
I hope you can help
I have a wordpress multisite with a custom login which takes users to the root wp-admin by default which gives this error for those who do not have the correct permission.
You attempted to access the "WordPress" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "WordPress" dashboard, please contact your network administrator.
I would like them to be redirected to the primary blog like this example.
http://wordpress.org/support/topic/automatic-redirection-to-child-site-from-main?replies=15
However, my custom plugin in my mu-plugins does not contain $current_user and none of the functions to get the current user work.
The other functions I have built work no problem, so I know there is nothing wrong with the file getting included.
I figured it out in the end.
I hope this helps someone
function check_if_user_needs_redirecting(){
$active_blog = get_active_blog_for_user(get_current_user_id());
$blogid = get_current_blog_id();
if ($blogid != $active_blog->blog_id){
header('Location: '.$active_blog->siteurl.'/wp-admin/');
exit;
}
}
add_action( 'init', 'check_if_user_needs_redirecting' );