[wp-hackers] Custom Post Types, Pretty URLs and Custom Query Vars

ErisDS erisds at gmail.com
Wed Nov 17 08:56:42 UTC 2010


On Wed, Nov 17, 2010 at 1:21 AM, scribu <mail at scribu.net> wrote:

> The problem is that your rewrite rules are added after the page rewrite
> rule
> (the most general one), so they don't have a chance to match your URL.
>

Hi Scribu,

Not sure if you realised, but company isn't a taxonomy, it's a custom field.
Plus if I print out $wp_rewrite I have the structure shown below - my rule
is the first one so it should be matched first, and the general rules are at
the bottom.

So I don't think the order is the problem?

Excerpt of wp_rewrite inc all job-vacancies rules:


[job-vacancies/company/?([0-9]{1,})/?$] =>
index.php?post_type_index=1&post_type=job&company=$matches[2]
[job-vacancies/[^/]+/attachment/([^/]+)/?$] =>
index.php?attachment=$matches[1]
[job-vacancies/[^/]+/attachment/([^/]+)/trackback/?$] =>
index.php?attachment=$matches[1]&tb=1
[job-vacancies/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] =>
index.php?attachment=$matches[1]&feed=$matches[2]
[job-vacancies/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] =>
index.php?attachment=$matches[1]&feed=$matches[2]
[job-vacancies/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] =>
index.php?attachment=$matches[1]&cpage=$matches[2]
[job-vacancies/([^/]+)/trackback/?$] => index.php?job=$matches[1]&tb=1
[job-vacancies/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] =>
index.php?job=$matches[1]&feed=$matches[2]
[job-vacancies/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] =>
index.php?job=$matches[1]&feed=$matches[2]
[job-vacancies/([^/]+)/page/?([0-9]{1,})/?$] =>
index.php?job=$matches[1]&paged=$matches[2]
[job-vacancies/([^/]+)/comment-page-([0-9]{1,})/?$] =>
index.php?job=$matches[1]&cpage=$matches[2]
[job-vacancies/([^/]+)(/[0-9]+)?/?$] =>
index.php?job=$matches[1]&page=$matches[2]
[job-vacancies/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]
[job-vacancies/[^/]+/([^/]+)/trackback/?$] =>
index.php?attachment=$matches[1]&tb=1
[job-vacancies/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] =>
index.php?attachment=$matches[1]&feed=$matches[2]
[job-vacancies/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] =>
index.php?attachment=$matches[1]&feed=$matches[2]
[job-vacancies/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] =>
index.php?attachment=$matches[1]&cpage=$matches[2]
...
... tonnes more rules
...
[(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$] =>
index.php?category_name=$matches[1]&feed=$matches[2]
[(.+?)/(feed|rdf|rss|rss2|atom)/?$] =>
index.php?category_name=$matches[1]&feed=$matches[2]
[(.+?)/page/?([0-9]{1,})/?$] =>
index.php?category_name=$matches[1]&paged=$matches[2]
[(.+?)/comment-page-([0-9]{1,})/?$] =>
index.php?category_name=$matches[1]&cpage=$matches[2]
[(.+?)/?$] => index.php?category_name=$matches[1]


More information about the wp-hackers mailing list