Skip to content

Instantly share code, notes, and snippets.

@willybahuaud
Created November 12, 2014 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willybahuaud/67625e4331e0fc1fd826 to your computer and use it in GitHub Desktop.
Save willybahuaud/67625e4331e0fc1fd826 to your computer and use it in GitHub Desktop.
<?php
add_filter( 'get_sample_permalink_html', 'willy_filter_fake_permalink', 10, 4 );
function willy_filter_fake_permalink( $return, $id, $newtitle, $newslug ) {
remove_filter( 'get_sample_permalink_html', 'willy_filter_fake_permalink' );
if ( $newslug === NULL ) {
if ( 'post' == get_post_type( $id ) ) {
$return = preg_replace( "/id=\"editable-post-name\"([^>]*)>/", "id=\"editable-post-name\"$1>actualite-", $return );
$return = preg_replace( "/id=\"editable-post-name-full\">/", "id=\"editable-post-name-full\">actualite-", $return );
}
}
return $return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment