#22338 closed defect (bug) (fixed)
Add filter for the output from `get_sample_permalink`
Reported by: | simonwheatley | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 3.4.2 |
Component: | Permalinks | Keywords: | has-patch 2nd-opinion |
Focuses: | 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 (5)
Change History (20)
#1
@
12 years ago
For context, here's where I would hope to use this in my multi-language plugin: https://github.com/simonwheatley/babble/commit/749cd96402a15944a017696282a0e66ee6bb8cfe
#2
@
12 years ago
Your patch is actually your plugin commit. Could you upload a patch that implements this?
#5
in reply to:
↑ 4
@
12 years ago
Replying to JustinSainton:
Belated thanks, Justin!
#9
@
9 years ago
- Keywords needs-refresh added; dev-feedback has-patch removed
- Milestone changed from Awaiting Review to 4.4
- Owner set to chriscct7
- Status changed from new to assigned
Patch needs to be refreshed from src but otherwise it looks fine.
This ticket was mentioned in Slack in #core by sergey. View the logs.
9 years ago
#12
@
9 years ago
- Owner changed from chriscct7 to SergeyBiryukov
- Status changed from assigned to reviewing
#13
follow-up:
↓ 15
@
9 years ago
Some cleanup in 22338.4.diff.
Since we're going to pass the post object to the filter as the last argument, I think we should explicitly pass $post->ID
instead of $id
, which can be a post ID or post object.
This is not consistent with 'get_sample_permalink_html'
filter, which receives $id
and not $post->ID
, but it's too late to change that.
Adds a filter to get_sample_permalink