简体   繁体   English

WooCommerce - 插件激活后停止重定向到欢迎屏幕

[英]WooCommerce - Stop redirect to welcome screen upon plugin activation

I am looking for a way to stop WooCommerce from redirecting the user to the welcome screen upon the plugin activation.我正在寻找一种方法来阻止 WooCommerce 在插件激活时将用户重定向到欢迎屏幕。

在此处输入图片说明

Does anyone have some code to do that?有没有人有一些代码可以做到这一点?

You could try this instead:你可以试试这个:

add_filter( 'woocommerce_enable_setup_wizard', '__return_false' );

Same effect using an existing filter.使用现有过滤器的效果相同。

Okay, I figured it out.好吧,我想通了。 If anyone else needs help with this the code is below.如果其他人需要帮助,代码如下。

//Old Solution: Stop WooCommerce redirect on activation
// function woocommerce_no_redirect_on_activation() {
//  delete_transient( '_wc_activation_redirect' );
// };
// add_action( 'init', 'woocommerce_no_redirect_on_activation');

Edit: anikitas answer is better.编辑:anikitas 的答案更好。 I accepted their answer as the best solution:我接受了他们的答案作为最佳解决方案:

//Stop WooCommerce redirect on activation
add_filter( 'woocommerce_enable_setup_wizard', '__return_false' );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM