Using %postname% tag with a Custom Permastruct creates 400 Bad Request Errors from the server

This is related to another question that I had asked earlier. I’m doing some rewrite code to create some custom permalinks for a custom post type. I think I’m getting it mostly working except I’m getting the following error:

400 Bad Request
I noticed a few things:

Read More
  1. Whatever I have as the postname gets replaced in the url field as %postname%
  2. If I omit the post name, it loads up in WordPress no problem

Here is the code to setup the rewrite:

add_action('init', 'setup_rewrites');
function setup_rewrites() {
        global $wp_rewrite;
        //Content
        add_rewrite_tag('%seriesname%','([^/]+)');
        add_rewrite_tag('%contenttype%','([^/]+)');
        $content_struct = '/content/%seriesname%/%contenttype%/%postname%';
        add_permastruct('veda_content', $content_struct, false);

    }

an example url that doesn’t work but should:
http://watchonepiecelegally.com/content/one-piece/episode/test-1

A URL that does work:
http://watchonepiecelegally.com/content/one-piece/episode/

What I get via Jan Fabry’s Rewrite Analyzer plugin:
enter image description here

This should work but I’m missing something. Can anyone give me a hand?

EDIT: As requested, here are the rewrite rules WordPress is generating. Hopefully this helps:

Array
(
    [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]
    [anime-series/.+?/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
    [anime-series/.+?/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [anime-series/.+?/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [anime-series/.+?/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [anime-series/.+?/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [anime-series/(.+?)/trackback/?$] => index.php?veda_series=$matches[1]&tb=1
    [anime-series/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_series=$matches[1]&feed=$matches[2]
    [anime-series/(.+?)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_series=$matches[1]&feed=$matches[2]
    [anime-series/(.+?)/page/?([0-9]{1,})/?$] => index.php?veda_series=$matches[1]&paged=$matches[2]
    [anime-series/(.+?)/comment-page-([0-9]{1,})/?$] => index.php?veda_series=$matches[1]&cpage=$matches[2]
    [anime-series/(.+?)(/[0-9]+)?/?$] => index.php?veda_series=$matches[1]&page=$matches[2]
    [anime-release/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
    [anime-release/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [anime-release/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [anime-release/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [anime-release/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [anime-release/([^/]+)/trackback/?$] => index.php?veda_release=$matches[1]&tb=1
    [anime-release/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_release=$matches[1]&feed=$matches[2]
    [anime-release/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_release=$matches[1]&feed=$matches[2]
    [anime-release/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_release=$matches[1]&paged=$matches[2]
    [anime-release/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?veda_release=$matches[1]&cpage=$matches[2]
    [anime-release/([^/]+)(/[0-9]+)?/?$] => index.php?veda_release=$matches[1]&page=$matches[2]
    [anime-release/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]
    [anime-release/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [anime-release/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [anime-release/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [anime-release/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [anime_video/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
    [anime_video/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [anime_video/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [anime_video/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [anime_video/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [anime_video/([^/]+)/trackback/?$] => index.php?veda_video=$matches[1]&tb=1
    [anime_video/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_video=$matches[1]&feed=$matches[2]
    [anime_video/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_video=$matches[1]&feed=$matches[2]
    [anime_video/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_video=$matches[1]&paged=$matches[2]
    [anime_video/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?veda_video=$matches[1]&cpage=$matches[2]
    [anime_video/([^/]+)(/[0-9]+)?/?$] => index.php?veda_video=$matches[1]&page=$matches[2]
    [anime_video/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]
    [anime_video/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [anime_video/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [anime_video/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [anime_video/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [anime_purchase/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
    [anime_purchase/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [anime_purchase/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [anime_purchase/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [anime_purchase/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [anime_purchase/([^/]+)/trackback/?$] => index.php?veda_purchase=$matches[1]&tb=1
    [anime_purchase/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_purchase=$matches[1]&feed=$matches[2]
    [anime_purchase/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_purchase=$matches[1]&feed=$matches[2]
    [anime_purchase/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_purchase=$matches[1]&paged=$matches[2]
    [anime_purchase/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?veda_purchase=$matches[1]&cpage=$matches[2]
    [anime_purchase/([^/]+)(/[0-9]+)?/?$] => index.php?veda_purchase=$matches[1]&page=$matches[2]
    [anime_purchase/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]
    [anime_purchase/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [anime_purchase/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [anime_purchase/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [anime_purchase/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [anime-review/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
    [anime-review/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [anime-review/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [anime-review/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [anime-review/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [anime-review/([^/]+)/trackback/?$] => index.php?veda_review=$matches[1]&tb=1
    [anime-review/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_review=$matches[1]&feed=$matches[2]
    [anime-review/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_review=$matches[1]&feed=$matches[2]
    [anime-review/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_review=$matches[1]&paged=$matches[2]
    [anime-review/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?veda_review=$matches[1]&cpage=$matches[2]
    [anime-review/([^/]+)(/[0-9]+)?/?$] => index.php?veda_review=$matches[1]&page=$matches[2]
    [anime-review/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]
    [anime-review/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [anime-review/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [anime-review/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [anime-review/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [subtitle_language/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_subtitle_language=$matches[1]&feed=$matches[2]
    [subtitle_language/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_subtitle_language=$matches[1]&feed=$matches[2]
    [subtitle_language/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_subtitle_language=$matches[1]&paged=$matches[2]
    [subtitle_language/([^/]+)/?$] => index.php?veda_subtitle_language=$matches[1]
    [audio_language/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_audio_language=$matches[1]&feed=$matches[2]
    [audio_language/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_audio_language=$matches[1]&feed=$matches[2]
    [audio_language/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_audio_language=$matches[1]&paged=$matches[2]
    [audio_language/([^/]+)/?$] => index.php?veda_audio_language=$matches[1]
    [genre/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_genre=$matches[1]&feed=$matches[2]
    [genre/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_genre=$matches[1]&feed=$matches[2]
    [genre/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_genre=$matches[1]&paged=$matches[2]
    [genre/([^/]+)/?$] => index.php?veda_genre=$matches[1]
    [studio/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_studio=$matches[1]&feed=$matches[2]
    [studio/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_studio=$matches[1]&feed=$matches[2]
    [studio/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_studio=$matches[1]&paged=$matches[2]
    [studio/([^/]+)/?$] => index.php?veda_studio=$matches[1]
    [content_type/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_content_type=$matches[1]&feed=$matches[2]
    [content_type/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_content_type=$matches[1]&feed=$matches[2]
    [content_type/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_content_type=$matches[1]&paged=$matches[2]
    [content_type/([^/]+)/?$] => index.php?veda_content_type=$matches[1]
    [publisher/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_publisher=$matches[1]&feed=$matches[2]
    [publisher/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_publisher=$matches[1]&feed=$matches[2]
    [publisher/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_publisher=$matches[1]&paged=$matches[2]
    [publisher/([^/]+)/?$] => index.php?veda_publisher=$matches[1]
    [release_type/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_release_type=$matches[1]&feed=$matches[2]
    [release_type/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_release_type=$matches[1]&feed=$matches[2]
    [release_type/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_release_type=$matches[1]&paged=$matches[2]
    [release_type/([^/]+)/?$] => index.php?veda_release_type=$matches[1]
    [release_rating/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_rating=$matches[1]&feed=$matches[2]
    [release_rating/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_rating=$matches[1]&feed=$matches[2]
    [release_rating/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_rating=$matches[1]&paged=$matches[2]
    [release_rating/([^/]+)/?$] => index.php?veda_rating=$matches[1]
    [video_source/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_video_source=$matches[1]&feed=$matches[2]
    [video_source/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_video_source=$matches[1]&feed=$matches[2]
    [video_source/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_video_source=$matches[1]&paged=$matches[2]
    [video_source/([^/]+)/?$] => index.php?veda_video_source=$matches[1]
    [retailer/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_retailer=$matches[1]&feed=$matches[2]
    [retailer/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_retailer=$matches[1]&feed=$matches[2]
    [retailer/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_retailer=$matches[1]&paged=$matches[2]
    [retailer/([^/]+)/?$] => index.php?veda_retailer=$matches[1]
    [content/[^/]+/[^/]+/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
    [content/[^/]+/[^/]+/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [content/[^/]+/[^/]+/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [content/[^/]+/[^/]+/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [content/[^/]+/[^/]+/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [content/([^/]+)/([^/]+)/([^/]+)/trackback/?$] => index.php?seriesname=$matches[1]&contenttype=$matches[2]&name=$matches[3]&tb=1
    [content/([^/]+)/([^/]+)/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?seriesname=$matches[1]&contenttype=$matches[2]&name=$matches[3]&feed=$matches[4]
    [content/([^/]+)/([^/]+)/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?seriesname=$matches[1]&contenttype=$matches[2]&name=$matches[3]&feed=$matches[4]
    [content/([^/]+)/([^/]+)/([^/]+)/page/?([0-9]{1,})/?$] => index.php?seriesname=$matches[1]&contenttype=$matches[2]&name=$matches[3]&paged=$matches[4]
    [content/([^/]+)/([^/]+)/([^/]+)(/[0-9]+)?/?$] => index.php?seriesname=$matches[1]&contenttype=$matches[2]&name=$matches[3]&page=$matches[4]
    [content/[^/]+/[^/]+/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]
    [content/[^/]+/[^/]+/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
    [content/[^/]+/[^/]+/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [content/[^/]+/[^/]+/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
    [content/[^/]+/[^/]+/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
    [content/([^/]+)/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?seriesname=$matches[1]&contenttype=$matches[2]&feed=$matches[3]
    [content/([^/]+)/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?seriesname=$matches[1]&contenttype=$matches[2]&feed=$matches[3]
    [content/([^/]+)/([^/]+)/page/?([0-9]{1,})/?$] => index.php?seriesname=$matches[1]&contenttype=$matches[2]&paged=$matches[3]
    [content/([^/]+)/([^/]+)/?$] => index.php?seriesname=$matches[1]&contenttype=$matches[2]
    [content/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?seriesname=$matches[1]&feed=$matches[2]
    [content/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?seriesname=$matches[1]&feed=$matches[2]
    [content/([^/]+)/page/?([0-9]{1,})/?$] => index.php?seriesname=$matches[1]&paged=$matches[2]
    [content/([^/]+)/?$] => index.php?seriesname=$matches[1]
    [robots.txt$] => index.php?robots=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})/([^/]+)(/[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})/comment-page-([0-9]{1,})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&cpage=$matches[3]
    [([0-9]{4})/comment-page-([0-9]{1,})/?$] => index.php?year=$matches[1]&cpage=$matches[2]
    [.+?/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]
)

%seriesname% is a slug that coincides with the parent of the post. %contenttype% coincides with a custom taxonomy. The idea was that if the %postname% tag was omitted, those two other tags could be used to create an archive page.

EDIT: Making progress. As noted in the discussion in the comments, using the builtin %postname% tag with a custom permastruct seems to be the cause of my 400 Bad Request Errors. Hopefully this should narrow down what the problem seems to be.

Related posts

Leave a Reply

1 comment

  1. Okay, I feel stupid.

    I needed to translate %postname%. I thought it did so automatically since the admin page looked like it had but apparently if you do use custom permastructs, you have to translate even the default tags.

    My solution: add this to my post_type_link filter:

    $post = get_post($post_id);
    $permalink =  str_replace('%postname%', $post->post_name, $permalink);
    

    Problem solved.