I have a custom taxonomy. I was able to access the list of items with term foo in taxonomy bar at mysite.dev/?bar=foo
. I then changed my permalink options from the default to "post name". I can no longer access my taxonomies at /?bar=foo
nor at /bar/foo
, which is what it directs me to when I go (via the dashboard) to Posts > bar > foo > View. I get a WP 404 (not an Apache 404).
My .htaccess contains only
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
and I have tried the MySQL query delete from wp_options where option_name="rewrite_rules"
followed by re-saving the permalink settings. There was no change.
Yes, I have cleared caches, via the command line: wp cache flush
The taxonomy is registered in functions.php:
// Hook to run the function on init
add_action('init', 'register_taxonomy_topic');
function register_taxonomy_bar() {
register_taxonomy(
'bar',
array('post'),
array(
'label' => __('Bar'),
'show_ui' => true,
'hierarchical' => false,
'capabilities' => array(
'manage_terms' => 'administrator',
'edit_terms' => 'administrator',
'delete_terms' => 'administrator',
)
)
);
}
add_action('init', 'register_taxonomy_bar');
var_dump($wp_query['request'])
gives me SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_name = 'barfoo' AND wp_posts.post_type = 'post' ORDER BY wp_posts.post_date DESC
so I can see it's looking for a post called "barfoo" instead of posts with term "foo" in taxonomy "bar".
I've tried registering the same taxonomy in exactly the same way in the twentyfourteen theme that comes with Wordpress, and I get the same problem. The plugins I have active are: Advanced Custom Fields, Advanced Custom Fields: Nav Menu Field, Advanced Custom Fields Pro, Enhanced Media Library, Google XML Sitemaps, Redirection, SVG Support, The Events Calendar, and Timber. I've tried to disable Redirection to see if that's the problem but it won't allow me to disable it.
I've tried updating everything to the latest version which went smoothly but didn't fix this problem.
What causes this and how do I fix it?
var_dump($wp_query)
in the template to see what WordPress is looking for.