请确保在主题或插件功能中正确设置了add_rewrite_rule。确保使用正确的函数参数,在函数中添加必要的操作。以下是一个示例代码片段:
//添加新的Rewrite规则 function custom_rewrite_rule() { add_rewrite_rule('^blogs/([^/]*)/?','index.php?pagename=blogs&blog=$matches[1]','top'); } add_action('init', 'custom_rewrite_rule', 10, 0);
// 激活时刷新规则 function custom_rewrite_flush() { flush_rewrite_rules(); } register_activation_hook( FILE, 'custom_rewrite_flush' );