0
I 하바 사용자 정의 포스트 유형오류 redicrect 때 재 작성 URL을 사용자 정의 포스트 유형
function anime_post_type() {
register_post_type('anime', array(
'labels' => array(
'name' => 'Anime',
'singular_name' => 'Anime',
'add_new' => _x('Thêm Anime', 'animefrost'),
'add_new_item' => 'Thêm Anime Mới',
),
'show_ui' => true,
'public' => true,
'menu_icon' => 'dashicons-video-alt3',
'exclude_from_search' => true,
'hierarchical' => false,
'rewrite' => array('slug' => 'story', 'with_front' => FALSE),
'supports' => array('title', 'editor', 'thumbnail')
)
);
//flush_rewrite_rules(false);
}
그리고 난으로
http://localhost/Anime/story/one-pice/?ep=1에 http://localhost/Anime/story/one-pice/ep/1
을 다시 할 내 코드
function add_query_vars_filter($vars){
$vars[] = "ep";
return $vars;
}
add_filter('query_vars', 'add_query_vars_filter');
add_action('init', 'dcc_rewrite_rules');
function dcc_rewrite_rules() {
add_rewrite_rule('^story/([^/]+)/ep/([0-9]+)$','index.php?post_type=anime&ep=$matches[2]','top');
flush_rewrite_rules(false);
}
내 코드에서 오류가 무엇입니까 ??? 도와주세요, 고마워요.
시도하고 있지만 is_front 페이지로 리디렉션됩니다. –