【发布时间】:2017-07-07 23:02:37
【问题描述】:
我在接收来自%category% 的$wp_rewrite->page_structure 的值时遇到问题:
function custom_page_rules() {
global $wp_rewrite;
$wp_rewrite->page_structure = $wp_rewrite->root .'/%category%/%pagename%';
//flush_rewrite_rules();
}
add_action( 'init', 'custom_page_rules',1 );
如何在$wp_rewrite->page_structure 中接收%category%?
现在它返回: http://example.com/%category%/the-page-slug/
相反: http://example.com/my-cat-slug/the-page-slug/
注意页面类别运行良好:
http://example.com/my-cat-slug/ 返回此类别的所有页面。
【问题讨论】:
标签: php wordpress custom-wordpress-pages