hb
定义问答页面的固定
/**
* 自定义问答页面的固定链接结构为 id.html
* https://www.ilxtx.com/dw-question-answer.html
*/
add_filter('post_type_link', 'custom_qa_link', 1, 3);
function custom_qa_link( $link, $post = 0 ){
if ( $post->post_type == 'dwqa-question' ){
return home_url( 'question/' . $post->ID .'.html' );
} else {
return $link;
}
}
add_action( 'init', 'custom_qa_rewrites_init' );
function custom_qa_rewrites_init(){
add_rewrite_rule(
'question/([0-9]+)?.html$',
'index.php?post_type=dwqa-question&p=$matches[1]',
'top' );
}
Warning: Attempt to read property "roles" on bool in /var/blog/wp-content/themes/slearn-pro/Module/View/Single.class.php on line 142




