Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#21050 closed enhancement (worksforme)

EP_TAXONOMY : Rewrite endpoints don't work for custom taxonomies

Reported by: wpsmith Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Rewrite Rules Keywords:
Focuses: Cc:


From what I can see and have tested, I simply cannot get a double custom taxonomy query to rewrite using endpoints.
Ex. http://domain.com/?taxonomy_name1=tax-slug-1&taxonomy_name2=tax-slug-2

If I add an endpoint:

add_rewrite_endpoint( 'taxonomy_name1', EP_NONE );
add_rewrite_endpoint( 'taxonomy_name1', EP_PERMALINKS );
add_rewrite_endpoint( 'taxonomy_name1', EP_ALL );
add_rewrite_endpoint( 'taxonomy_name1', EP_CATEGORIES );

None of these work. Instead I had to build out a new permastructure via add_permastruct().

However, EP_CATEGORIES (and thus EP_TAGS) both acted as expected. However, it would be great to be able to have EP_TAXONOMY that automatically built out the rewrite rules by adding the appropriate endpoint. Or is this too ambitious?

Change History (7)

#1 @johnbillion
8 years ago

  • Cc johnbillion added

#2 @scribu
8 years ago

  • Cc scribu added

#4 follow-up: @misterbisson
8 years ago

  • Resolution set to worksforme
  • Status changed from new to closed

UPDATE: this is either fixed and is no longer a problem, or resulted from a misunderstanding when calling register_taxonomy().

register_taxonomy() (see http://core.trac.wordpress.org/browser/trunk/wp-includes/taxonomy.php#L314 ) defaults to 'ep_mask' => EP_NONE. The solution to this bug is to explicitly set the rewrite options and set 'ep_mask' => EP_TAGS or similar. rewrite.php (see http://core.trac.wordpress.org/browser/trunk/wp-includes/rewrite.php#L111 ) defines a number of masks, EP_TAGS, EP_CATEGORIES, and EP_ALL seem most useful.

#5 @markoheijnen
8 years ago

  • Milestone Awaiting Review deleted

#6 in reply to: ↑ 4 @iwtravelllc
5 years ago

Thank you!

#7 @paddelboot
5 years ago

I think it should be called EP_TAXONOMIES.

Note: See TracTickets for help on using tickets.