Opened 7 months ago

Last modified 5 weeks ago

#22338 new defect (bug)

Add filter for the output from `get_sample_permalink`

Reported by: simonwheatley 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)

22338-sw.diff (974 bytes) - added by simonwheatley 7 months ago.
Adds a filter to get_sample_permalink
22338.2.patch (406 bytes) - added by JustinSainton 6 months ago.
Helping a brother out.

Download all attachments as: .zip

Change History (7)

Adds a filter to get_sample_permalink

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?

  • Keywords needs-patch added; has-patch removed

Helping a brother out.

comment:4 follow-up: ↓ 5   JustinSainton6 months ago

  • Keywords has-patch added; needs-patch removed

comment:5 in reply to: ↑ 4   simonwheatley5 weeks ago

Replying to JustinSainton:

Belated thanks, Justin!

Note: See TracTickets for help on using tickets.