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
Description
We are currently using preview_post_link to customize the preview link for a custom post type that we have registered. The hook works well while the post is in a "publish" state but fails to apply while the post is in draft mode nor is there any hook that I can find that filters the preview link specifically while in draft mode. The filter looks similar to this:
<?php
add_filter( 'preview_post_link', array( $this, 'change_preview_link' ), 10, 2 );
public function change_preview_link( $preview_link, $post ) {
if ( $post->post_type !== $this->post_type) return $preview_link;
// ...Parse/construct link
return $preview_link;
}
?>
The behavior I expected was for the preview button to be filtered as a draft, auto-draft, and published. I assumed that I would be specifying any unique logic using $post->post_status to assign conditionally or that there would be a hook specific to the preview link as a draft for example preview_post_link_draft. Any help would be appreciated.
Thank you,
Bula
Chief Technology Officer
The DNK Office
Editor version:
WordPress version: 5.5.1
Default Block Editor
Desktop (please complete the following information):
iOS
Safari
Version 13.1.2
The text was updated successfully, but these errors were encountered:
Hi there @TeamDNK ! I'm afraid this is a known issue with no certain timeline to be fixed. You can read more about it in #13998. I'm going to go ahead and close this one as it's essentially a duplicate of #13998, but please feel free to reopen if this doesn't answer your question!
Description
We are currently using
preview_post_link
to customize the preview link for a custom post type that we have registered. The hook works well while the post is in a "publish" state but fails to apply while the post is in draft mode nor is there any hook that I can find that filters the preview link specifically while in draft mode. The filter looks similar to this:The behavior I expected was for the preview button to be filtered as a draft, auto-draft, and published. I assumed that I would be specifying any unique logic using
$post->post_status
to assign conditionally or that there would be a hook specific to the preview link as a draft for examplepreview_post_link_draft
. Any help would be appreciated.Thank you,
Bula
Chief Technology Officer
The DNK Office
Editor version:
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: