需要wordpress永久链接解决方案

时间:2015-12-07 10:21:27

标签: wordpress

我创建了一个名为“供应商”的自定义帖子类型及其分类标记为“vendors_category”,

我需要像

这样的永久链接
  

../厂商/ {商务名称}

     

../厂商/类别/ {类别名}

找到以下代码的帖子类型,

        register_post_type('vendors', array(
            'labels' => array(
                    'name' => __("Vendor Listings", ACL_PLUGIN_TD),
                    'singular_name' => __("Vendor Listing", ACL_PLUGIN_TD)
                ),
            'public' => true,
            'publicly_queryable' => true,
            'has_archive' => true,
            'show_ui' => true,
            'rewrite' => array(
                'slug' => 'vendors',
                'with_front' => false
                ),              
            'query_var' => true,
            'capability_type' => 'post',
            'hierarchical' => false,
            'menu_icon' => ACL_PLUGIN_CUSTOM_URL . '/images/listings.png',
            'exclude_from_search' => false,
            'supports' => array('title', 'editor', 'thumbnail'),
        ) );    

        flush_rewrite_rules();  

对于分类法

        $labels = array(
            'name'              => __( 'Vendor Categories' ),
            'singular_name'     => __( 'Vendor Category' ),
            'search_items'      => __( 'Search Vendor Categories' ),
            'all_items'         => __( 'All Vendor Categories' ),
            'parent_item'       => __( 'Parent Vendor Category' ),
            'parent_item_colon' => __( 'Parent Vendor Category:' ),
            'edit_item'         => __( 'Edit Vendor Category' ), 
            'update_item'       => __( 'Update Vendor Category' ),
            'add_new_item'      => __( 'Add New Vendor Category' ),
            'new_item_name'     => __( 'New Vendor Category' ),
            'menu_name'         => __( 'Vendor Categories' ),
        );
        $args = array(
            'labels' => $labels,
            'hierarchical' => true,
            'rewrite' => array(
                'slug' => 'vendors/categories',
                'with_front' => false
                ),              
        );
        register_taxonomy( 'vendors_category', 'vendors', $args );          
        flush_rewrite_rules();  

但是当我创建taxonomy-vendors_category.php时,它不适用于此代码,并始终显示我找不到页面错误..有谁可以帮助我吗?

0 个答案:

没有答案