diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php
index 510d9a1..2f4fe42 100644
a
|
b
|
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 | /** |
| 169 | * Filters the list of post statuses which should use shortlinks and avoid fancy permalinks. |
| 170 | * |
| 171 | * @since 4.3.0 |
| 172 | * |
| 173 | * @param array $statuses The list of statuses |
| 174 | */ |
| 175 | $auto_short_link_statuses = apply_filters( |
| 176 | 'shortlink_post_statuses', |
| 177 | array( |
| 178 | 'draft', |
| 179 | 'pending', |
| 180 | 'auto-draft', |
| 181 | 'future', |
| 182 | ) |
| 183 | ); |
| 184 | |
| 185 | if ( '' != $permalink && ! in_array( $post->post_status, $auto_short_link_statuses ) ) { |
169 | 186 | $unixtime = strtotime( $post->post_date ); |
170 | 187 | |
171 | 188 | $category = ''; |
… |
… |
function get_post_permalink( $id = 0, $leavename = false, $sample = false ) { |
272 | 289 | |
273 | 290 | $slug = $post->post_name; |
274 | 291 | |
275 | | $draft_or_pending = get_post_status( $post ) && in_array( get_post_status( $post ), array( 'draft', 'pending', 'auto-draft', 'future' ) ); |
| 292 | $auto_short_link_statuses = apply_filters( |
| 293 | 'shortlink_post_statuses', |
| 294 | array( |
| 295 | 'draft', |
| 296 | 'pending', |
| 297 | 'auto-draft', |
| 298 | 'future', |
| 299 | ) |
| 300 | ); |
| 301 | |
| 302 | $draft_or_pending = get_post_status( $post ) && in_array( get_post_status( $post ), $auto_short_link_statuses ); |
276 | 303 | |
277 | 304 | $post_type = get_post_type_object( $post->post_type ); |
278 | 305 | |
… |
… |
function get_post_permalink( $id = 0, $leavename = false, $sample = false ) { |
305 | 332 | * |
306 | 333 | * @since 3.0.0 |
307 | 334 | * |
| 335 | * |
308 | 336 | * @param string $post_link The post's permalink. |
309 | 337 | * @param WP_Post $post The post in question. |
310 | 338 | * @param bool $leavename Whether to keep the post name. |
… |
… |
function _get_page_link( $post = false, $leavename = false, $sample = false ) { |
368 | 396 | |
369 | 397 | $post = get_post( $post ); |
370 | 398 | |
371 | | $draft_or_pending = in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft' ) ); |
| 399 | $auto_short_link_statuses = apply_filters( |
| 400 | 'shortlink_post_statuses', |
| 401 | array( |
| 402 | 'draft', |
| 403 | 'pending', |
| 404 | 'auto-draft', |
| 405 | 'future', |
| 406 | ) |
| 407 | ); |
| 408 | |
| 409 | $draft_or_pending = get_post_status( $post ) && in_array( get_post_status( $post ), $auto_short_link_statuses ); |
372 | 410 | |
373 | 411 | $link = $wp_rewrite->get_page_permastruct(); |
374 | 412 | |