diff --git wp-admin/includes/post.php wp-admin/includes/post.php
index 774bd1ea34..f237965bd9 100644
|
|
|
function get_sample_permalink( $id, $title = null, $name = null ) { |
| 1341 | 1341 | $original_date = $post->post_date; |
| 1342 | 1342 | $original_name = $post->post_name; |
| 1343 | 1343 | |
| 1344 | | // Hack: get_permalink() would return ugly permalink for drafts, so we will fake that our post is published. |
| 1345 | | if ( in_array( $post->post_status, array( 'draft', 'pending', 'future' ) ) ) { |
| 1346 | | $post->post_status = 'publish'; |
| 1347 | | $post->post_name = sanitize_title( $post->post_name ? $post->post_name : $post->post_title, $post->ID ); |
| 1348 | | } |
| 1349 | | |
| 1350 | 1344 | // If the user wants to set a new name -- override the current one. |
| 1351 | 1345 | // Note: if empty name is supplied -- use the title instead, see #6072. |
| 1352 | 1346 | if ( ! is_null( $name ) ) { |
diff --git wp-includes/link-template.php wp-includes/link-template.php
index 4d47a8fae4..5d07f3f277 100644
|
|
|
function get_permalink( $post = 0, $leavename = false ) { |
| 165 | 165 | */ |
| 166 | 166 | $permalink = apply_filters( 'pre_post_link', $permalink, $post, $leavename ); |
| 167 | 167 | |
| 168 | | if ( '' != $permalink && ! in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft', 'future' ) ) ) { |
| | 168 | if ( ( '' != $permalink && ! in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft', 'future' ) ) ) || $sample ) { |
| | 169 | if ( $sample ) { |
| | 170 | $post->post_name = sanitize_title( $post->post_name ? $post->post_name : $post->post_title, $post->ID ); |
| | 171 | } |
| 169 | 172 | |
| 170 | 173 | $category = ''; |
| 171 | 174 | if ( strpos( $permalink, '%category%' ) !== false ) { |