我目前正在尝试自定义一个功能,在最终成员插件。该函数具有如下所示的add_action:
add_action('um_post_registration', 'um_post_registration', 10, 2);
function um_post_registration( $user_id, $args ){ some code }我试图用以下代码删除子主题上的action:
add_action('plugins_loaded','remove_whatever', 11);
function remove_whatever() {
if (function_exists('um_post_registration')) {
remove_action('um_post_registration', 'um_post_registration', 10, 2);
}
}但不起作用。我甚至不知道是否可以覆盖一个来自子主题的插件函数,但我在网上进行了研究,似乎每个人都建议使用remove_action。任何信息都会有帮助。谢谢。
发布于 2016-09-03 06:33:05
尝尝这个
<?php
add_action('init', 'remove_whatever');
function remove_whatever() {
if(remove_action('um_post_registration', 'um_post_registration', 10)){
//echo 'Removed';
}else{
//echo 'Could nt remove';
}
}
?>https://stackoverflow.com/questions/39298186
复制相似问题