#40836 closed defect (bug) (invalid)
add_rewrite_endpoint() creates sub directories after endpoint
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | Rewrite Rules | Keywords: | |
| Focuses: | Cc: |
Description
Adding an endpoint with add_rewrite_endpoint() seems to also create sub directories after that endpoint. For example:
// Add query var.
add_filter( 'query_vars', function( $vars ) {
$vars[] = 'my-endpoint';
return $vars;
} );
// Add endpoint.
add_action( 'init', function() {
add_rewrite_endpoint( 'my-endpoint', EP_AUTHORS );
} );
I can now visit:
- example.com/author/my-endpoint
- example.com/author/my-endpoint/random
- example.com/author/my-endpoint/anything-here
Is this expected?
I believe the following should return a 404:
- example.com/author/my-endpoint/random
- example.com/author/my-endpoint/anything-here
Change History (2)
Note: See
TracTickets for help on using
tickets.
After researching this issue some more I see this is how
add_rewrite_endpoint()is intended to work.Anything after my-endpoint/ is matched by the rewrite rule and is therefore used in the query string.
Closing.