2

I have installed wordpress on /en folder and set siteurl on /. I transformed it to a Multisite website. it is running on topcanadavisa.com.

I used this code on function.php to define new post_type (articles):

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' );

and wordpress set these on .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]

What is happened is I am unable to set custom permalinks. all post type except "page" type returns 404 error. what can i do?

4

1 回答 1

0

I had this several times, especially with wordpress not finding the custom post types.

What i had to do was go to permalink settings and change them, and then change back to what i wanted. This flushes the rewrite-rules and after that it worked.

I had to do that manually and had the problem multiple times, with this as a solution each time.

于 2013-09-20T07:33:27.847 回答