该客户希望在每周二几个小时之间自动激活一个 wordpress 插件。这是因为该插件与另一个插件有冲突。我在网上没有找到任何关于此的内容,该怎么做...任何人都知道当单击按钮激活插件时 wordpress 背后会发生什么?我在我的 wordpress 文件夹中找不到该特定页面...谢谢!
我尝试过但不起作用的东西:
require('/web/htdocs/www.fattorefamiglia.com/home/wp-content/plugins/quick-chat/quick-chat.php');
function toggle_plugin() {
// Full path to WordPress from the root
$wordpress_path = '/web/htdocs/www.fattorefamiglia.com/home/';
// Absolute path to plugins dir
$plugin_path = $wordpress_path.'wp-content/plugins/';
// Absolute path to your specific plugin
$my_plugin = $plugin_path.'quick-chat/quick-chat.php';
$start = strtotime('1:30');
$end = strtotime('22:30');
$timenow = date('U');
if((date('w') == 3) && ($timenow >= $start && $timenow <= $end)) { // day 2 = Tuesday
activate_plugin($my_plugin);
}
else {
deactivate_plugins($my_plugin);
}
}
我把这段代码放在functions.php中