Opened 7 months ago
Last modified 5 weeks ago
#22338 new defect (bug)
Add filter for the output from `get_sample_permalink`
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Permalinks | Version: | 3.4.2 |
| Severity: | normal | Keywords: | dev-feedback has-patch |
| Cc: |
Description
When getting the sample permalink the post_name is not always set in the Post object at this point. The get_sample_permalink gets around this by hacking the post_name into the Post object for the duration of the function, however it is not possible to get this "hacked in" information from the post_type_link filter. I suggest that a filter should be added to the $permalink array (which contains the link and the post name string) and various additional parameters, including the hacked Post object.
The alternative would be to try to detect situations where the data needs to be hacked in, e.g. watching for particular action GET params in an AJAX context, but this seems like a hack too far.
Attachments (2)
Change History (7)
simonwheatley — 7 months ago
comment:1
simonwheatley — 7 months ago
For context, here's where I would hope to use this in my multi-language plugin: https://github.com/simonwheatley/babble/commit/749cd96402a15944a017696282a0e66ee6bb8cfe
Your patch is actually your plugin commit. Could you upload a patch that implements this?
comment:3
SergeyBiryukov — 6 months ago
- Keywords needs-patch added; has-patch removed
comment:4
follow-up:
↓ 5
JustinSainton — 6 months ago
- Keywords has-patch added; needs-patch removed
comment:5
in reply to:
↑ 4
simonwheatley — 5 weeks ago
Replying to JustinSainton:
Belated thanks, Justin!

Adds a filter to get_sample_permalink