How to disable Woocommerce Setup Wizard? - woocommerce

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' );

Related

Wordpress keeps on updating even after disabling auto update

I want to disable all updates in my website. I have set below variable in wp-config.php file.
define( 'automatic_updater_disabled', true );
define( 'wp_auto_update_core', false );
But I don't know why, every other day it keeps on updating itself, which breaks some of my code.
Does any one know how to disable the updates PERMANENTLY !
By default, WordPress can automatically update itself when a security or minor release is available.
For major releases, you have to initiate the update yourself. You also have to install plugin and theme updates yourself.
Wondering if you are on Managed Wordpress hosting??
IF YES then that's where those updates are happening automatically.
You can Hosting support to not update without confirming with you.
define( 'AUTOMATIC_UPDATER_DISABLED', true );
define( 'WP_AUTO_UPDATE_CORE', true );
Disable automatic WordPress plugin updates:
add_filter( 'auto_update_plugin', '__return_false' );
Disable automatic WordPress theme updates:
add_filter( 'auto_update_theme', '__return_false' );
For your better understanding please visit here
On some hosting platforms you install Wordpress as an 'App' through something like Installatron. This has settings about updating Wordpress too, you may want to check for this in your hosting backend/dashboard.
It looks like this
Where it says My blog it will probably say Wordpress. If you click edit below, it has some settings about updating.

When I try to open admin panel it get redirected to woocommerce setup wizard

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' );

Custom page / message after installation of wordpress plugins

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;
}

Wordpress custom MU plugin fetch user details

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' );

Wordpress hook action

What is the hook for validation on activation and download/upgrade plugin from wordpress ?
for activation, it is used register_activation_hook..Before activate it ( on the process of activating the plugin ) i will do some checking/validation..
If the verification return false, what is the hook for deactivate plugin ?
In order to deactivate the plugin, the hook is: register_deactivation_hook

Resources