【发布时间】:2022-01-16 07:00:11
【问题描述】:
我正在使用下面的代码来禁用特定 URL 路径的插件,但我还有更多路径要添加。例如,我喜欢禁用包含 /xxxx/、/xxxx1/、/xxxx2/、/xxxx3/、/xxxx4/ 的插件和 URL。
如何在下面的代码中包含所有其他 4 条路径?
// Do not load the plugin if the 404 URL starts with '/xxxx/'
add_filter('wp404arsp/init', 'my_404_no_init2', 10, 2);
function my_404_no_init2($init, $query){
// Print $query array for more request context
if (preg_match('#/xxxx/(.+?)/?$#i', $query['request']['url']))
$init = false;
return $init;
}
【问题讨论】: