我想从我的子主题functions.php文件中解除并修改一个动作。如何在插件文件中解除WordPress动作钩子?
WordPress插件Sensei在本文档的第86行添加了此操作。
https://github.com/Automattic/sensei/blob/master/includes/class-sensei-modules.php#L86
动作进一步引用的功能下降,负责用于输出动态头部元素的页面。
/**
* Show the title modules on the single course template.
*
* Function is hooked into sensei_single_course_modules_before.
*
* @since 1.8.0
* @return void
*/
public function course_modules_title() {
if(sensei_module_has_lessons()){
echo '<header><h2>' . __('Modules', 'woothemes-sensei') . '</h2></header>';
}
}
我的目标是将当前输出为'Modules'的html改为别的。
我已经尝试了以下在我的子主题functions.php文件,但似乎都没有工作。
remove_action('sensei_single_course_modules_before', array('Sensei_Core_Modules', 'course_modules_title'), 20);
remove_action('sensei_single_course_modules_before', array('Sensei()->Sensei_Core_Modules', 'course_modules_title'), 20);
的问题是,我不知道如何确定初始参数,要添加到数组来调用正确的类。因为我正在外部访问它,所以我不能使用$this
,因为它正在核心文件中使用。