-
-
Save billerickson/36c6c2d37f425f5000e51c00db2d478f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Fix the Post Title Link on Edit Comments | |
* @author Bill Erickson | |
* @link http://www.billerickson.net/fixing-post-title-link-editing-comments/ | |
* | |
* @param string $link, the edit post link | |
* @param int $post_id, the post ID | |
* @param string $context, The link context. If set to 'display' then ampersands are encoded. | |
* @return string $link, modified edit post link | |
*/ | |
function be_fix_post_title_link_on_edit_comments( $link, $post_id, $context ) { | |
if( ! is_admin() ) | |
return $link; | |
$screen = get_current_screen(); | |
if( $screen->base == 'edit-comments' ) | |
$link = get_permalink( $post_id ); | |
return $link; | |
} | |
add_filter( 'get_edit_post_link', 'be_fix_post_title_link_on_edit_comments', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment