wordpress中的自定义帖子类型不能与永久链接一起使用

时间:2015-06-12 21:14:47

标签: wordpress permalinks

我在wordpress中有自定义帖子类型,当我尝试使用漂亮的永久链接/%postname%/帖子没有显示在屏幕上。我在创建新帖子类型时使用的代码是

add_action( 'init', 'dogs' );

function dogs(){
$labels = array(
    'name' => 'Dogs',
    'singular_name' => 'Dog',
    'add_new' => 'Add New Dog',
    'add_new_item' => 'Add New Dog',
    'edit_item' => 'Edit Dog Details',
    'new_item' => 'New Dog',
    'all_items' => 'All Dogs',
    'view_items' => 'View Dogs',
    'search_items' => 'Search Dogs',
    'not_found' => 'No Dogs Found',
    'not_found_in_trash' => 'No Dogs Found in Trash',
    'menu_name' => 'Dogs',

    );

    $args = array(
        'labels' => $labels,
        'public' => true,
        'rewrite' => true,
        'supports' => array( 'title','editor','thumbnail','excerpt', 'category', 'terms' )
    );

    register_post_type( 'dogs', $args);

}

我一直在网上搜索试图找到答案,任何人都可以帮忙吗?

0 个答案:

没有答案
相关问题