对于普通帖子,可以在设置上设置永久链接结构→ Permalinks
所有详细信息可在Codex
对于自定义帖子类型,您可以在注册时设置slug:
add_action( \'init\', \'create_posttype\' );
function create_posttype() {
register_post_type( \'cpost\',
array(
\'labels\' => array(
\'name\' => __( \'cpost\' ),
\'singular_name\' => __( \'cpost\' )
),
\'public\' => true,
\'has_archive\' => true,
\'rewrite\' => array(
\'slug\' => \'cpost\',
\'with_front\' => true
),
)
);
}
希望有帮助,干杯