問題描述

我一直試圖透過學習分類法的內容和方法,以及如何將它們整合到主題中,我遇到了一個我似乎無法想象的一個非常基本的問題。

我開始在 BuddyPress 安裝中使用更多分類法進行工作。在無法使用平臺的重寫塊 (taxonomy-platform.php) 載入自定義模板… www.mydomain.com/wpinstall/platform …. 我刪除了更多分類法的分類法 (但不是條目在資料庫中的條款),解除安裝更多分類法,並進入我的 Buddypress functions.php 分類。

首先我用

    //hook into the init action and call create_platform_taxonomies when it fires
add_action( 'init', 'create_platform_taxonomies', 0);
//create the non-heirarchical Platforms taxonomy
function create_platform_taxonomies()
{


  // Adding a taxonomy for Platforms, non heirarchical
$labels = array(
    'name' => _x( 'Platforms', 'taxonomy general name' ),
    'singular_name' => _x( 'Platform', 'taxonomy singular name' ),
    'search_items' =>  __( 'Search Platforms' ),
    'popular_items' => __( 'Popular Platforms' ),
    'all_items' => __( 'All Platforms' ),
    'parent_item' => null,
    'parent_item_colon' => null,
    'edit_item' => __( 'Edit Platform' ),
    'update_item' => __( 'Update Platform' ),
    'add_new_item' => __( 'Add New Platform' ),
    'new_item_name' => __( 'New Platform Name' ),
    'separate_items_with_commas' => __( 'Separate platforms with commas' ),
    'add_or_remove_items' => __( 'Add or remove platforms' ),
    'choose_from_most_used' => __( 'Choose from the most used platforms' ),
    'menu_name' => __( 'Platforms' ),
  );

  register_taxonomy('platform',
    array( 'post', 'page', 'mediapage', 'attachment', 'revision', 'nav_menu_item', 'cheats', 'reviews', 'tutorials' ),
        array(
            'hierarchical' => false,
            'labels' => $labels,
            'show_ui' => true,
            'query_var' => true,
            'rewrite' => array( 'slug' => 'platform' ),
  ));
}

但仍然不允許它正常工作。

*讓我在這裡注意到,我已經是 over-zealous 關於在整個過程中使用 「永久連結」 頁面儲存方法來重新整理我的重寫。

然後我回滾到 2010 年,並將相同的程式碼輸入 functions.php,並再次嘗試相同的結果。分類法顯示在所有的帖子型別下,它從資料庫中拉出了舊的資料,正確輸入了帖子,但是我無法開啟 taxonomy-platform.php 頁面,總是得到一個 「該頁面找不到」 的錯誤。

所以現在我寫了我覺得是一個更加傾倒的分類學,並嘗試過;

    add_action( 'init', 'create_testtax_taxonomies', 0);

 function create_testtax_taxonomies()
 {
 register_taxonomy ( 'testtax', array( 'post', ),
    array(
        'hierarchical' => false,
        'labels' => array( 'Testtax', ),
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => array( 'slug' => 'testtax' ),
        ));

 }

這顯示 (雖然它被稱為我的帖子型別中的第二個’Post Tags’,但我認為這是因為我減少了標籤這麼大),但是當嘗試導航到 www.mydomain.com/wpinstall/testtax 時顯示相同的行為

這是我的程式碼為 taxonomy-testtax.php 頁面

<?php

/* This is the custom template for
* the platforms taxonomy.
*/

get_header(); ?>

        <div id="container">
            <div id="content" role="main">
hello

            </div><!-- #content -->
        </div><!-- #container -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

再次,儘可能的簡單,但我也使用索引和其他各種 loop-enabled 頁面的副本。

任何幫助將不勝感激,謝謝提前!不知道我是否缺少一些簡單的東西,或者在正確啟用分類法的情況下跳過一個過程… 只是不確定。




新增一些更多的資訊來擴充套件一些下面的答案/評論 (找不到更有效的方法來做到這一點)

我看到一些關於這種問題的帖子,我注意到有些人能夠從 WordPress 沖洗整個軟 re-write 規則。我想我會看到我是否可以自己得到同樣的列印。首先我補充說

add_action('wp_footer', 'show_rewrite_rules');
function show_rewrite_rules(){
  global $wp_rewrite;
  echo "<pre>";
  print_r($wp_rewrite->rules);
  echo "</pre>";
}

所以,補充說,在 2010 年的我的 Functions.php(我幾乎保持我的 2010 主題和我的 BuddyPress 安裝/主題 uptodate 與所有這些可能的修復和更改和測試兩者都 – 再次停用外掛幾次,完成一個儲存,因為我已經嘗試了下面的一些建議) 。我得到這個輸出

Array
(
    [categories/(.+)/search_type/(.+)/order/(.+)/page/(.+)] => index.php?cat=$matches[1]&search_type=$matches[2]&order=$matches[3]&paged=$matches[4]
    [categories/(.+)/search_type/(.+)/order/(.+)] => index.php?cat=$matches[1]&search_type=$matches[2]&order=$matches[3]
    [categories/(.+)/page/(.+)] => index.php?cat=$matches[1]&paged=$matches[2]
    [categories/(.+)] => index.php?cat=$matches[1]
    [promotion/?$] => index.php?post_type=ps_promotion
    [promotion/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?post_type=ps_promotion&feed=$matches[1]
    [promotion/(feed|rdf|rss|rss2|atom)/?$] => index.php?post_type=ps_promotion&feed=$matches[1]
    [promotion/page/([0-9]{1,})/?$] => index.php?post_type=ps_promotion&paged=$matches[1]
    [category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?category_name=$matches[1]&feed=$matches[2]
    [category/(.+?)/(feed|rdf|rss|rss2|atom)/?$] => index.php?category_name=$matches[1]&feed=$matches[2]
    [category/(.+?)/page/?([0-9]{1,})/?$] => index.php?category_name=$matches[1]&paged=$matches[2]
    [category/(.+?)/?$] => index.php?category_name=$matches[1]
    [tag/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?tag=$matches[1]&feed=$matches[2]
    [tag/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?tag=$matches[1]&feed=$matches[2]
    [tag/([^/]+)/page/?([0-9]{1,})/?$] => index.php?tag=$matches[1]&paged=$matches[2]
    [tag/([^/]+)/?$] => index.php?tag=$matches[1]
    [type/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?post_format=$matches[1]&feed=$matches[2]
    [type/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?post_format=$matches[1]&feed=$matches[2]
    [type/([^/]+)/page/?([0-9]{1,})/?$] => index.php?post_format=$matches[1]&paged=$matches[2]
    [type/([^/]+)/?$] => index.php?post_format=$matches[1]
    [cheats/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
    [cheats/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [cheats/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [cheats/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [cheats/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [cheats/([^/]+)/trackback/?$] => index.php?cheats=$matches[1]&tb=1
    [cheats/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?cheats=$matches[1]&feed=$matches[2]
    [cheats/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?cheats=$matches[1]&feed=$matches[2]
    [cheats/([^/]+)/page/?([0-9]{1,})/?$] => index.php?cheats=$matches[1]&paged=$matches[2]
    [cheats/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?cheats=$matches[1]&cpage=$matches[2]
    [cheats/([^/]+)/entry(/(.*))?/?$] => index.php?cheats=$matches[1]&entry=$matches[3]
    [cheats/([^/]+)(/[0-9]+)?/?$] => index.php?cheats=$matches[1]&page=$matches[2]
    [cheats/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]
    [cheats/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [cheats/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [cheats/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [cheats/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [reviews/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
    [reviews/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [reviews/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [reviews/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [reviews/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [reviews/([^/]+)/trackback/?$] => index.php?reviews=$matches[1]&tb=1
    [reviews/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?reviews=$matches[1]&feed=$matches[2]
    [reviews/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?reviews=$matches[1]&feed=$matches[2]
    [reviews/([^/]+)/page/?([0-9]{1,})/?$] => index.php?reviews=$matches[1]&paged=$matches[2]
    [reviews/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?reviews=$matches[1]&cpage=$matches[2]
    [reviews/([^/]+)/entry(/(.*))?/?$] => index.php?reviews=$matches[1]&entry=$matches[3]
    [reviews/([^/]+)(/[0-9]+)?/?$] => index.php?reviews=$matches[1]&page=$matches[2]
    [reviews/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]
    [reviews/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [reviews/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [reviews/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [reviews/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [tutorials/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
    [tutorials/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [tutorials/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [tutorials/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [tutorials/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [tutorials/([^/]+)/trackback/?$] => index.php?tutorials=$matches[1]&tb=1
    [tutorials/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?tutorials=$matches[1]&feed=$matches[2]
    [tutorials/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?tutorials=$matches[1]&feed=$matches[2]
    [tutorials/([^/]+)/page/?([0-9]{1,})/?$] => index.php?tutorials=$matches[1]&paged=$matches[2]
    [tutorials/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?tutorials=$matches[1]&cpage=$matches[2]
    [tutorials/([^/]+)/entry(/(.*))?/?$] => index.php?tutorials=$matches[1]&entry=$matches[3]
    [tutorials/([^/]+)(/[0-9]+)?/?$] => index.php?tutorials=$matches[1]&page=$matches[2]
    [tutorials/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]
    [tutorials/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [tutorials/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [tutorials/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [tutorials/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [platform/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?platform=$matches[1]&feed=$matches[2]
    [platform/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?platform=$matches[1]&feed=$matches[2]
    [platform/([^/]+)/page/?([0-9]{1,})/?$] => index.php?platform=$matches[1]&paged=$matches[2]
    [platform/([^/]+)/?$] => index.php?platform=$matches[1]
    [testtax/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?testtax=$matches[1]&feed=$matches[2]
    [testtax/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?testtax=$matches[1]&feed=$matches[2]
    [testtax/([^/]+)/page/?([0-9]{1,})/?$] => index.php?testtax=$matches[1]&paged=$matches[2]
    [testtax/([^/]+)/?$] => index.php?testtax=$matches[1]
    [promotion/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
    [promotion/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [promotion/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [promotion/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [promotion/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [promotion/([^/]+)/trackback/?$] => index.php?ps_promotion=$matches[1]&tb=1
    [promotion/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?ps_promotion=$matches[1]&feed=$matches[2]
    [promotion/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?ps_promotion=$matches[1]&feed=$matches[2]
    [promotion/([^/]+)/page/?([0-9]{1,})/?$] => index.php?ps_promotion=$matches[1]&paged=$matches[2]
    [promotion/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?ps_promotion=$matches[1]&cpage=$matches[2]
    [promotion/([^/]+)/entry(/(.*))?/?$] => index.php?ps_promotion=$matches[1]&entry=$matches[3]
    [promotion/([^/]+)(/[0-9]+)?/?$] => index.php?ps_promotion=$matches[1]&page=$matches[2]
    [promotion/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]
    [promotion/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [promotion/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [promotion/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [promotion/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [promotions/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?promotion-categories=$matches[1]&feed=$matches[2]
    [promotions/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?promotion-categories=$matches[1]&feed=$matches[2]
    [promotions/([^/]+)/page/?([0-9]{1,})/?$] => index.php?promotion-categories=$matches[1]&paged=$matches[2]
    [promotions/([^/]+)/?$] => index.php?promotion-categories=$matches[1]
    [(.+)/entry/%entry%/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?%entry%$matches[1]&feed=$matches[2]
    [(.+)/entry/%entry%/(feed|rdf|rss|rss2|atom)/?$] => index.php?%entry%$matches[1]&feed=$matches[2]
    [(.+)/entry/%entry%/page/?([0-9]{1,})/?$] => index.php?%entry%$matches[1]&paged=$matches[2]
    [(.+)/entry/%entry%/?$] => index.php?%entry%$matches[1]
    [.*wp-atom.php$] => index.php?feed=atom
    [.*wp-rdf.php$] => index.php?feed=rdf
    [.*wp-rss.php$] => index.php?feed=rss
    [.*wp-rss2.php$] => index.php?feed=rss2
    [.*wp-feed.php$] => index.php?feed=feed
    [.*wp-commentsrss2.php$] => index.php?feed=rss2&withcomments=1
    [feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?&feed=$matches[1]
    [(feed|rdf|rss|rss2|atom)/?$] => index.php?&feed=$matches[1]
    [page/?([0-9]{1,})/?$] => index.php?&paged=$matches[1]
    [comments/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?&feed=$matches[1]&withcomments=1
    [comments/(feed|rdf|rss|rss2|atom)/?$] => index.php?&feed=$matches[1]&withcomments=1
    [comments/page/?([0-9]{1,})/?$] => index.php?&paged=$matches[1]
    [search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?s=$matches[1]&feed=$matches[2]
    [search/(.+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?s=$matches[1]&feed=$matches[2]
    [search/(.+)/page/?([0-9]{1,})/?$] => index.php?s=$matches[1]&paged=$matches[2]
    [search/(.+)/?$] => index.php?s=$matches[1]
    [author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?author_name=$matches[1]&feed=$matches[2]
    [author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?author_name=$matches[1]&feed=$matches[2]
    [author/([^/]+)/page/?([0-9]{1,})/?$] => index.php?author_name=$matches[1]&paged=$matches[2]
    [author/([^/]+)/?$] => index.php?author_name=$matches[1]
    [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]
    [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]
    [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]
    [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]
    [([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]
    [([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]
    [([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]
    [([0-9]{4})/([0-9]{1,2})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]
    [([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&feed=$matches[2]
    [([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&feed=$matches[2]
    [([0-9]{4})/page/?([0-9]{1,})/?$] => index.php?year=$matches[1]&paged=$matches[2]
    [([0-9]{4})/?$] => index.php?year=$matches[1]
    [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
    [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&tb=1
    [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]
    [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]
    [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/page/?([0-9]{1,})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&paged=$matches[5]
    [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&cpage=$matches[5]
    [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/entry(/(.*))?/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&entry=$matches[6]
    [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&page=$matches[5]
    [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]
    [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/comment-page-([0-9]{1,})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&cpage=$matches[4]
    [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/entry(/(.*))?/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&entry=$matches[5]
    [([0-9]{4})/([0-9]{1,2})/comment-page-([0-9]{1,})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&cpage=$matches[3]
    [([0-9]{4})/([0-9]{1,2})/entry(/(.*))?/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&entry=$matches[4]
    [([0-9]{4})/comment-page-([0-9]{1,})/?$] => index.php?year=$matches[1]&cpage=$matches[2]
    [([0-9]{4})/entry(/(.*))?/?$] => index.php?year=$matches[1]&entry=$matches[3]
    [.+?/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
    [.+?/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [.+?/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [.+?/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [.+?/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [(.+?)/trackback/?$] => index.php?pagename=$matches[1]&tb=1
    [(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?pagename=$matches[1]&feed=$matches[2]
    [(.+?)/(feed|rdf|rss|rss2|atom)/?$] => index.php?pagename=$matches[1]&feed=$matches[2]
    [(.+?)/page/?([0-9]{1,})/?$] => index.php?pagename=$matches[1]&paged=$matches[2]
    [(.+?)/comment-page-([0-9]{1,})/?$] => index.php?pagename=$matches[1]&cpage=$matches[2]
    [(.+?)(/[0-9]+)?/?$] => index.php?pagename=$matches[1]&page=$matches[2]
)

所以我看到平臺和 Testtax 在那裡,他們沒有像我的自定義帖子型別重寫的行多少,但是從我可以告訴它看起來像他們有規則應該使這項工作。

最佳解決方案

我找到這個程式碼

function ftc_flush_rewrites() {
global $wp_rewrite;
$wp_rewrite->flush_rules();
}

function ftc_add_rewrites() {
global $wp_rewrite;
$ftc_new_non_wp_rules = array(
'find/(this)' => '/addit.php?here=$1',
);

$wp_rewrite->non_wp_rules = $ftc_new_non_wp_rules + $wp_rewrite->non_wp_rules;
}

add_action('generate_rewrite_rules', 'ftc_add_rewrites');
add_action('admin_init', 'ftc_flush_rewrites');

在這個執行緒 http://wordpress.org/support/topic/writing-wp_rewrite-gtnon_wp_rules-to-htaccess … 不知道如果這是解決問題,但祝你好運!

次佳解決方案

/platform 頁面不存在,因為 WordPress 不僅僅是根據您的 URL 結構建立一個頁面。

如果需要在其中顯示內容,可以建立一個名為”platform” 的”Page” 。

taxonomy-platform.php 是平臺分類法中術語歸檔的預設模板。

taxonomy-platform-some_term.php 是一個特定術語的歸檔模板。

所有 WordPress 歸檔模板都用於術語歸檔。 WordPress 沒有內建的方式將分類名稱與帖子相關聯,只有分類術語可以與帖子相關聯。

分類名稱=平臺

  • some-platform(平臺術語)

URL = http://some-domain.com/platform/some-platform

將使用 some-platform 分類術語列出所有帖子

可以刪除”platform” 插槽前端,但不可能有分類歸檔頁面:

http://some-domain.com/platform/

並獲取所有具有與之關聯的平臺分類的帖子,而不建立具有自定義模板的平臺頁面進行必要的查詢。

您的模板 taxonomy-platform.php 將用於任何平臺術語歸檔頁面。

第三種解決方案

嘗試這個:

/**
* flush_rewrite_rules()
* Flush the rewrite rules, which forces the regeneration with new rules.
* return void.
**/
function flush_rewrite_rules()
{
    global $wp_rewrite;
    $wp_rewrite->flush_rules();
}

參考文獻

注:本文內容整合自 Google/Baidu/Bing 輔助翻譯的英文資料結果。如果您對結果不滿意,可以加入我們改善翻譯效果:薇曉朵技術論壇。