[wp-hackers] 404 template loads instead of taxonomy

Mike Schinkel mikeschinkel at newclarity.net
Mon Mar 8 19:45:40 UTC 2010


Hi Enej,

I've been in custom taxonomies all weekend.  I think you need to flush the rules.  

Try going to the Permalinks page and click save after updating, or use this code in your theme after your register taxonomy but don't use that code to run every time except for in a development:

	global $wp_rewrite;
	$wp_rewrite->flush_rules(false);

If you are registering a taxonomy in a plugin you I think this is what you'd do:

function your_activation_func()  {
	global $wp_rewrite;
	$wp_rewrite->flush_rules(false);
}
register_activation_hook(__FILE__, 'your_activation_func');

HTH.

-Mike




On Mar 8, 2010, at 2:14 PM, Enej Bajgoirc wrote:

> Hi 
> 
> I am developing a custom theme that is using, the custom taxonomy 
> 
> 
> I have this in my functions.php file of the theme.
> 
> add_action( 'init', 'phylomon_taxonomies', 0 );
> function phylomon_taxonomies() {
> 	register_taxonomy( 'classification', 'post', array( 'hierarchical' => false, 'label' => 'Classification', 'query_var' => true, 'rewrite' => array( 'slug' => 'classification' )  ) );
> 
> }
> 
> However the urls that I generate with 
> <?php echo get_the_term_list( $post->ID, 'classification',"",", "); ?> 
> don't render the taxonomy.php file that I have inside the theme folder. 
> instead the 404.php file is used. 
> 
> I am not sure if I am missing something. 
> When I do something like <?php var_dump($wp_rewrite); ?> I can see that the rewrite rules have been written 
> to the wp_rewrite object. 
> 
> ["extra_rules_top"]=>
>  array(4) {
>    ["classification/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$"]=>
>    string(53) "index.php?classification=$matches[1]&feed=$matches[2]"
>    ["classification/([^/]+)/(feed|rdf|rss|rss2|atom)/?$"]=>
>    string(53) "index.php?classification=$matches[1]&feed=$matches[2]"
>    ["classification/([^/]+)/page/?([0-9]{1,})/?$"]=>
>    string(54) "index.php?classification=$matches[1]&paged=$matches[2]"
>    ["classification/([^/]+)/?$"]=>
>    string(36) "index.php?classification=$matches[1]"
>  }
> ["extra_permastructs"]=>
>  array(1) {
>    ["classification"]=>
>    string(32) "/classification/%classification%"
>  }
> and it other places as well. I am using wordpress MU 2.9.1 and developing on MAMPs. 
> also the contents of my .htaccess file look like this 
> RewriteEngine On
> RewriteBase /
> 
> #uploaded files
> RewriteRule ^(.*/)?files/$ index.php [L]
> RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
> RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]
> RewriteRule ^(.*/)?avatar/(.*) wp-content/avatar.php?file=$2 [L]
> 
> # add a trailing slash to /wp-admin
> RewriteCond %{REQUEST_URI} ^.*/wp-admin$
> RewriteRule ^(.+)$ $1/ [R=301,L]
> 
> RewriteCond %{REQUEST_FILENAME} -f [OR]
> RewriteCond %{REQUEST_FILENAME} -d
> RewriteRule . - [L]
> RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
> RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
> RewriteRule . index.php [L]
> 
> <IfModule mod_security.c>
> <Files async-upload.php>
> SecFilterEngine Off
> SecFilterScanPOST Off
> </Files>
> </IfModule>
> 
> Any help with this would be greatly appreciated. 
> 
> Thanks Enej
> 
> 
> 
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list