Skip to content

Instantly share code, notes, and snippets.

@sapel
Created July 18, 2014 18:01
Show Gist options
  • Select an option

  • Save sapel/5f31aa4853cf073be82d to your computer and use it in GitHub Desktop.

Select an option

Save sapel/5f31aa4853cf073be82d to your computer and use it in GitHub Desktop.
add_filter( 'get_sample_permalink_html', 't5_unabridge_sample_permalink', 10, 2 );
/**
* Replaces the shortened permalink with its full form.
*
* @param string $sample Permalink HTML
* @param int $id Post ID
* @return string
*/
function t5_unabridge_sample_permalink( $sample, $id )
{
$link = get_sample_permalink( $id );
$s1 = '<span id="editable-post-name" ';
$s2 = '</span>';
return preg_replace(
'~' . $s1 . '([^>]*)>([^<]*)' . $s2 . '~Ui',
$s1 . '$1>' . $link[1] . $s2,
$sample
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment