add_action( \'init\', \'wpa_category_base\' );
function wpa_category_base() {
// Remember to flush the rules once manually after you added this code!
add_rewrite_rule(
// The regex to match the incoming URL
\'news/([^/]+)/([^/]+)/([^/]+)(/[0-9]+)?/?$\',
// The resulting internal URL
\'index.php?category_name=$matches[1]/$matches[2]&name=$matches[3]&paged=$matches[4]\',
// Add the rule to the top of the rewrite list
\'top\' );
}
自定义永久链接结构:/media/%category%/%postname%/类别库:。
为我工作,WordPress 3.4.1,没有任何相关插件。
尝试
add_action( \'init\', \'wpa_category_base\' );
function wp_category_base() {
// Remember to flush the rules once manually after you added this code!
add_rewrite_rule(
// The regex to match the incoming URL
\'news/([^/]+)/([^/]+)/([^/][^f][^e][^e][^d]+)(/[0-9]+)?/?$\', //here my changes to exclude \'feed\'
// The resulting internal URL
\'index.php?category_name=$matches[1]/$matches[2]&name=$matches[3]&paged=$matches[4]\',
// Add the rule to the top of the rewrite list
\'top\' );
}