You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some content contains a [bw_link ID] shortcode, where ID is the post ID of a registered post type.
Clicking on the link displays the post.
The post type is then de-registered
How should the link now appear?
Actual Result
It displays an invalid permalink conforming to the custom structure defined in Permalink Settings.
e.g. for post ID 32932, published on 2016/05/25, with slug 'reactjs', using the Day and name permalink structure we get http://example.com/2016/05/25/reactjs/
The current logic uses get_permalink( $id ) to determine the permalink.
When passed a post ID, get_permalink calls get_post() to access the post.
It then checks the post_type to determine how to create the permalink - returning the correct format for "page", "attachment" and any registered post type that's not _builtin
Everything else is treated as a "post" using the permalink_structure option.
get_permalink() invokes the 'pre_post_link' filter first ( incorrectly documented as 'Only applies to posts with post_type of 'post' ). This filter hook is not normally implemented, so the permalink structure to be used is unchanged.
And just at the end of the function it invokes the "post_link" filter, also not normally implemented.
Conclusion
We could consider implementing the "post_link" filter to null out the result when the post type is not registered. But I don't think it's necessary.
I might raise a WordPress TRAC on the docblock for 'pre_post_link' though.
Imagine this scenario.
[bw_link ID]
shortcode, where ID is the post ID of a registered post type.How should the link now appear?
Actual Result
It displays an invalid permalink conforming to the custom structure defined in Permalink Settings.
e.g. for post ID 32932, published on 2016/05/25, with slug 'reactjs', using the Day and name permalink structure we get
http://example.com/2016/05/25/reactjs/
Clicking on the link displays the 404 page.
Expected result
Good question. Help wanted here.
See also humanmade/WordPress-Importer#38 (comment)
Notes about current implementation
[bw_link 1010101010101]
then no link is shown.The text was updated successfully, but these errors were encountered: