Changeset 21948 for trunk/wp-includes/link-template.php
- Timestamp:
- 09/21/2012 10:52:54 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/link-template.php
r21937 r21948 107 107 return get_page_link($post->ID, $leavename, $sample); 108 108 elseif ( $post->post_type == 'attachment' ) 109 return get_attachment_link( $post->ID);109 return get_attachment_link( $post->ID, $leavename ); 110 110 elseif ( in_array($post->post_type, get_post_types( array('_builtin' => false) ) ) ) 111 111 return get_post_permalink($post->ID, $leavename, $sample); … … 293 293 * 294 294 * @param mixed $post Optional. Post ID or object. 295 * @return string 296 */ 297 function get_attachment_link( $post = null ) { 295 * @param bool $leavename Optional. Leave name. 296 * @return string 297 */ 298 function get_attachment_link( $post = null, $leavename = false ) { 298 299 global $wp_rewrite; 299 300 … … 315 316 316 317 if ( strpos($parentlink, '?') === false ) 317 $link = user_trailingslashit( trailingslashit($parentlink) . $name ); 318 $link = user_trailingslashit( trailingslashit($parentlink) . '%postname%' ); 319 320 if ( ! $leavename ) 321 $link = str_replace( '%postname%', $name, $link ); 318 322 } 319 323
Note: See TracChangeset
for help on using the changeset viewer.