Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created April 6, 2016 17:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/36c6c2d37f425f5000e51c00db2d478f to your computer and use it in GitHub Desktop.
Save billerickson/36c6c2d37f425f5000e51c00db2d478f to your computer and use it in GitHub Desktop.
<?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