admin管理员组文章数量:1313735
So I have a following code inside the plugin:
if( window.wp.hooks.applyFilters( 'filtername', true, $(this) ) ) {
//do something
}
how can I make above statement always false without editing plugin files but using functions.php instead? I'm not sure if I understand applyfilters correctly but I've tried:
function filtername() {
return false;
}
add_filter( 'filtername', 'filtername', 10, 3 );
but it didn't work. What would be propper way to do it? Can someone please explain.
So I have a following code inside the plugin:
if( window.wp.hooks.applyFilters( 'filtername', true, $(this) ) ) {
//do something
}
how can I make above statement always false without editing plugin files but using functions.php instead? I'm not sure if I understand applyfilters correctly but I've tried:
function filtername() {
return false;
}
add_filter( 'filtername', 'filtername', 10, 3 );
but it didn't work. What would be propper way to do it? Can someone please explain.
Share Improve this question asked Nov 27, 2020 at 15:19 Greg VivGreg Viv 1232 bronze badges 2- I don't know how the client side wp.hooks works, but I'd be surprised if it called into server-side filters. Do you need a client-side filter instead? – Rup Commented Nov 27, 2020 at 15:34
- I just realized this is javascript hook indeed. I don't know why I looked at php function to solve it. – Greg Viv Commented Nov 27, 2020 at 16:47
1 Answer
Reset to default 3JS hooks don't do server-side calls to retrieve PHP declared hooks.
wp.hooks.addFilter( 'hookName', 'namespace', () => { return false; }, 10 )
本文标签: filtersHow to make applyFilters function return false via functionsphp
版权声明:本文标题:filters - How to make applyFilters function return false via functions.php 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741959018a2407159.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论