admin管理员组文章数量:1415100
simple issue but i need some help because i dont why i m wrong on this...
The apply filter (Important, this is in construct Class):
if ( apply_filters( 'tc_bridge_for_woocommerce_content_order_table_is_after', true ) == true ) {
add_action(
'woocommerce_email_after_order_table',
array( &$this, 'tc_add_content_email_after_order_table' ),
99,
4
);
} else {
add_action(
'woocommerce_email_before_order_table',
array( &$this, 'tc_add_content_email_after_order_table' ),
99,
4
);
}
I need to use the false from the conditionnal
so in my functions.php from my theme
function filter_after_setup_theme() {
add_filter( 'tc_bridge_for_woocommerce_content_order_table_is_after', '__return_false' ); // move info ticket in email before order details
}
add_action('after_setup_theme', 'filter_after_setup_theme');
where i m wrong ?
thanks
simple issue but i need some help because i dont why i m wrong on this...
The apply filter (Important, this is in construct Class):
if ( apply_filters( 'tc_bridge_for_woocommerce_content_order_table_is_after', true ) == true ) {
add_action(
'woocommerce_email_after_order_table',
array( &$this, 'tc_add_content_email_after_order_table' ),
99,
4
);
} else {
add_action(
'woocommerce_email_before_order_table',
array( &$this, 'tc_add_content_email_after_order_table' ),
99,
4
);
}
I need to use the false from the conditionnal
so in my functions.php from my theme
function filter_after_setup_theme() {
add_filter( 'tc_bridge_for_woocommerce_content_order_table_is_after', '__return_false' ); // move info ticket in email before order details
}
add_action('after_setup_theme', 'filter_after_setup_theme');
where i m wrong ?
thanks
Share Improve this question edited Sep 5, 2019 at 18:20 WebMat asked Sep 5, 2019 at 18:05 WebMatWebMat 331 silver badge6 bronze badges2 Answers
Reset to default 0Instead of adding the filter inside of the add_action()
, you need to call the filter directly. You have this in your functions.php file:
function filter_after_setup_theme() {
add_filter( 'tc_bridge_for_woocommerce_content_order_table_is_after', '__return_false' );
}
add_action('after_setup_theme', 'filter_after_setup_theme');
You are telling to WordPress to execute the filter when the action after_setup_theme
happens (which is called before init
hook, according to the Actions Hooks list).
Instead of the action, you should leave the filter to be registered alone, so instead of the previous code, you do this:
add_filter( 'tc_bridge_for_woocommerce_content_order_table_is_after', '__return_false' );
That filter will be registered in WordPress when the functions.php is loaded and not when the add_action('after_setup_theme', 'filter_after_setup_theme');
is executed.
If you still need to execute the filter inside a hook, I recommend to do it in init
or maybe wp_loaded
hooks.
My bad thing is resolved (@thanks to support of Tickera)
The add_filter must be used before the loading of plugins. (with custom plugin)
本文标签: hooksAdd filter return false not working
版权声明:本文标题:hooks - Add filter return false not working 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745180060a2646424.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论