2

wordpress を/enフォルダにインストールし、siteurl を/に設定しました。マルチサイトのウェブサイトに変えました。topcanadavisa.comで実行されています。

function.php でこのコードを使用して、新しい post_type (記事) を定義しました。

function codex_custom_init() { 
register_taxonomy('articles-category',array(), array(
    'has-archives' => true,
    'hierarchical' => true, 
    'show_ui' => true,  
    'query_var' => true, 
    'rewrite' => array( 'slug' => 'archive' ),
    ));

register_post_type('articles', array(
    'capability_type' => 'post',    
    'hierarchical' => false,
    'public' => true,               
    'show_ui' => true,                  
    'query_var' => true,        
    'publicly_queryable' => true,   
    'exclude_from_search' => false,
    'supports' => array( 'title', 'editor', 'excerpt', 'trackbacks', 'thumbnail' , 'author', 'custom-fields' ),
    'rewrite' => array( 'slug' => 'articles' ),
    'has-archives' => true,
    'taxonomies' => array( 'articles-category' ,'post_tag') 
));
//flush_rewrite_rules();
} add_action( 'init', 'codex_custom_init' );

そしてwordpressはこれらを.htaccessに設定します:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) en/$2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ en/$2 [L]
    RewriteRule . index.php [L]

カスタムパーマリンクを設定できません。「ページ」タイプを除くすべての投稿タイプが 404 エラーを返します。私に何ができる?

4

1 に答える 1