Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
functions.php中的Wordpress添加\重写\规则返回404_Php_Wordpress_Rewrite - Fatal编程技术网

functions.php中的Wordpress添加\重写\规则返回404

functions.php中的Wordpress添加\重写\规则返回404,php,wordpress,rewrite,Php,Wordpress,Rewrite,我试图在function.php中添加以下代码以添加我自己的重写规则,但它返回404: add_rewrite_rule('all_comments/([0-9]+)/?$', 'index.php?pagename=all_comments&post_id=$matches[1]', 'top'); 当我试图编写一个测试规则时,它还返回404: add_rewrite_rule('testss$', 'index.php', 'top'); $wp_rewrite->flush

我试图在function.php中添加以下代码以添加我自己的重写规则,但它返回404:

add_rewrite_rule('all_comments/([0-9]+)/?$', 'index.php?pagename=all_comments&post_id=$matches[1]', 'top');
当我试图编写一个测试规则时,它还返回404:

add_rewrite_rule('testss$', 'index.php', 'top');
$wp_rewrite->flush_rules(true);
我的add_rewrite_规则函数肯定有问题,但我无法解决


非常感谢。

好吧,最后我发现这是一个名为“重写”的插件,它使用自己的规则列表而不是我自己的规则列表。我删除了它,它现在可以工作了