remove_action in plugin file 时间:2013-08-28 作者:Noob Theory 我正在尝试使用remove_action( \'admin_notices\', \'woothemes_updater_notice\' ); 在插件中防止编辑主题函数。php文件,但代码没有执行。我是否需要将其包装在插件文件中以使其工作? 2 个回复 SO网友:fuxia 确保在主题添加动作后将其删除。并使用相同的优先级。一种相当安全的方法是使用要清理的相同操作:add_action( \'admin_notices\', \'remove_woothemes_updater_notice\', 0 ); function remove_woothemes_updater_notice() { remove_action( \'admin_notices\', \'woothemes_updater_notice\' ); } SO网友:Noob Theory 发布后立即找到答案。如果有人有同样的问题,我用这个解决了。// Remove WooCommerce updater plugin notice function woothemes_updater_notice() { remove_action( \'admin_notices\', \'woothemes_updater_notice\' );} add_action( \'admin_head\', \'woothemes_updater_notice\' ); 结束 文章导航