我有一个关于更改wordpress安装的永久链接的问题。当我更改永久链接,发布名称'我的自定义帖子类型不起作用。图库页面和单个页面无效。我在我的CTP功能中设置了flush_rewrite_rules();
,但这对我不起作用。
如何解决?
<?php
/* CTP - Portfolio template */
if (function_exists('register_post_type')) {
// Set up an action and create the function
add_action('init', 'gallery_manager_register');
function gallery_manager_register() {
// Setting up the labels
$labels = array(
'name' => __('Galerij'),
'singular_name' => __('Galerij'),
'add_new' => _x('Add New', 'slide'),
'add_new_item' => __('Add New galerij'),
'edit_item' => __('Edit galerij'),
'new_item' => __('New galerij'),
'view_item' => __('View galerij'),
'search_items' => __('Search galerij'),
'not_found' => __('No galerij found'),
'not_found_in_trash' => __('No galerij found in Trash'),
);
// Arguments to create post type
$args = array(
'labels' => $labels,
'public' => true,
'show_ui' => true,
'capability_type' => 'post',
'hierarchical' => true,
'has_archive' => true,
'supports' => array('title', 'editor', 'thumbnail', 'excerpt'),
'rewrite' => array('slug' => 'galerij', 'with_front' => false),
);
// Register type and custom taxonomy for type
// Fire this during init
register_post_type('galerij', $args);
flush_rewrite_rules();
}
}
?>