Changeset 50282 for trunk/src/wp-includes/link-template.php
- Timestamp:
- 02/10/2021 05:38:23 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/link-template.php
r50168 r50282 91 91 92 92 /** 93 * Determine whether post should always use a n uglypermalink structure.93 * Determine whether post should always use a plain permalink structure. 94 94 * 95 95 * @since 5.7.0 … … 99 99 * If omitted, a sample link is generated if a post object is passed 100 100 * with the filter property set to 'sample'. 101 * @return bool Whether to use a n uglypermalink structure.102 */ 103 function wp_force_ ugly_post_permalink( $post = null, $sample = null ) {101 * @return bool Whether to use a plain permalink structure. 102 */ 103 function wp_force_plain_post_permalink( $post = null, $sample = null ) { 104 104 if ( 105 105 null === $sample && … … 126 126 127 127 if ( 128 // Publicly viewable links never have uglypermalinks.128 // Publicly viewable links never have plain permalinks. 129 129 is_post_status_viewable( $post_status_obj ) || 130 130 ( 131 // Private posts don't have uglylinks if the user can read them.131 // Private posts don't have plain permalinks if the user can read them. 132 132 $post_status_obj->private && 133 133 current_user_can( 'read_post', $post->ID ) 134 134 ) || 135 // Protected posts don't have uglylinks if getting a sample URL.135 // Protected posts don't have plain links if getting a sample URL. 136 136 ( $post_status_obj->protected && $sample ) 137 137 ) { … … 219 219 if ( 220 220 $permalink && 221 ! wp_force_ ugly_post_permalink( $post )221 ! wp_force_plain_post_permalink( $post ) 222 222 ) { 223 223 … … 330 330 $slug = $post->post_name; 331 331 332 $force_ ugly_link = wp_force_ugly_post_permalink( $post );332 $force_plain_link = wp_force_plain_post_permalink( $post ); 333 333 334 334 $post_type = get_post_type_object( $post->post_type ); … … 338 338 } 339 339 340 if ( ! empty( $post_link ) && ( ! $force_ ugly_link || $sample ) ) {340 if ( ! empty( $post_link ) && ( ! $force_plain_link || $sample ) ) { 341 341 if ( ! $leavename ) { 342 342 $post_link = str_replace( "%$post->post_type%", $slug, $post_link ); … … 344 344 $post_link = home_url( user_trailingslashit( $post_link ) ); 345 345 } else { 346 if ( $post_type->query_var && ( isset( $post->post_status ) && ! $force_ ugly_link ) ) {346 if ( $post_type->query_var && ( isset( $post->post_status ) && ! $force_plain_link ) ) { 347 347 $post_link = add_query_arg( $post_type->query_var, $slug, '' ); 348 348 } else { … … 426 426 $post = get_post( $post ); 427 427 428 $force_ ugly_link = wp_force_ugly_post_permalink( $post );428 $force_plain_link = wp_force_plain_post_permalink( $post ); 429 429 430 430 $link = $wp_rewrite->get_page_permastruct(); 431 431 432 if ( ! empty( $link ) && ( ( isset( $post->post_status ) && ! $force_ ugly_link ) || $sample ) ) {432 if ( ! empty( $link ) && ( ( isset( $post->post_status ) && ! $force_plain_link ) || $sample ) ) { 433 433 if ( ! $leavename ) { 434 434 $link = str_replace( '%pagename%', get_page_uri( $post ), $link ); … … 470 470 $link = false; 471 471 472 $post = get_post( $post );473 $force_ ugly_link = wp_force_ugly_post_permalink( $post );474 $parent_id = $post->post_parent;475 $parent = $parent_id ? get_post( $parent_id ) : false;476 $parent_valid = true; // Default for no parent.472 $post = get_post( $post ); 473 $force_plain_link = wp_force_plain_post_permalink( $post ); 474 $parent_id = $post->post_parent; 475 $parent = $parent_id ? get_post( $parent_id ) : false; 476 $parent_valid = true; // Default for no parent. 477 477 if ( 478 478 $parent_id && … … 487 487 } 488 488 489 if ( $force_ ugly_link || ! $parent_valid ) {489 if ( $force_plain_link || ! $parent_valid ) { 490 490 $link = false; 491 491 } elseif ( $wp_rewrite->using_permalinks() && $parent ) {
Note: See TracChangeset
for help on using the changeset viewer.