Last active
August 29, 2015 14:07
-
-
Save danielbachhuber/062f822e605b6a688828 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 | |
/* | |
* Hack to restore the post_name that get_default_post_to_edit() noops | |
* Our assigned post_name via wp_insert_post_data can get fubar on post-new.php | |
* | |
* @see https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes/post.php#L588 | |
*/ | |
add_filter( 'post_updated_messages', function( $messages ) { | |
global $pagenow, $post; | |
if ( 'post-new.php' == $pagenow && empty( $post->post_name ) ) { | |
$post = get_post( $post->ID ); | |
} | |
return $messages; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment