Opened 14 years ago
Closed 14 years ago
#9476 closed defect (bug) (fixed)
add_rewrite_endpoint() doesn't work
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 2.8 | Priority: | normal |
Severity: | normal | Version: | 2.8 |
Component: | Permalinks | Keywords: | has-patch needs-testing commit |
Focuses: | Cc: |
Description
While editing a plugin, I've noticed that this fails miserably:
add_rewrite_endpoint('print', EP_PERMALINK);
While this succeeds:
global $wp_rewrite; $wp_rewrite->add_endpoint('print', EP_PERMALINK); $wp_rewrite->flush_rules();
Shouldn't it flush the rules automatically?
Attachments (1)
Change History (6)
#1
in reply to:
↑ description
@
14 years ago
#2
@
14 years ago
Ok... so it's like, the flush should occur on activate and deactivate then.
It should probably be clarified in the docs, then.
Note: See
TracTickets for help on using
tickets.
Replying to Denis-de-Bernardy:
No. Adding an endpoint and generating the rewrite rules are two separate actions. When you add an endpoint, you're adding an endpoint to the pool of potential endpoints, which will be used the next time the rewrite rules are generated. So whereas one regenerates the rewrite rules only infrequently (for example, when a plugin is activated), the endpoint needs to be added to the pool of potential endpoints on every load of WP, so that it will be available to use in the case that something else flushes and regenerates the rules.