0
我正在研究一个名为PointFinder的WordPress安装。用户发布的项目会在某个预定义的时间段后被删除。我的目标是禁用此行为。我已经找到相应的代码行,并取消激活add_action
挂钩,该挂钩触发schedule-config.php
中的周期性调用功能pointfinder_clean_pending_orders()
,该功能暂时可以正常工作。如何安全地删除子主题中的动作钩子?
add_action('pointfinder_schedule_hooks_hourly', 'pointfinder_clean_pending_orders'); // <--- commented out this line
function pointfinder_clean_pending_orders() {
/* code that cleans-up ... */
}
如何在我的孩子主题中实现停用?如果我简单地在我的孩子主题中添加一个remove_action
到functions.php
,那会起作用吗?我不确定首先会叫什么,add_action
在schedule-config.php
或我的remove_action
在functions.php
?
我只能访问生产性服务器和没有测试环境,因此我对实验有点不情愿。
感谢您的回答!根据https://codex.wordpress.org/Function_Reference/remove_action,没有只有一个参数的'remove_action'方法签名。而且,我没有太多的实验空间,因为我只能访问高效的网页。不幸的是,没有可用的测试环境,因此我需要非常肯定它会起作用,否则我将通过定期删除算法来释放更多数据。 – salocinx
修复了具有正确方法用法的答案。 –
非常感谢你:)我会试试这个。 – salocinx