Changeset 13023
- Timestamp:
- 02/08/2010 04:23:32 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/link-template.php
r12987 r13023 108 108 return get_attachment_link($post->ID); 109 109 elseif ( in_array($post->post_type, get_post_types( array('_builtin' => false) ) ) ) 110 return get_post_ link($post);110 return get_post_permalink($post); 111 111 112 112 $permalink = get_option('permalink_structure'); … … 172 172 * @return string 173 173 */ 174 function get_post_ link( $id = 0, $leavename = false, $sample = false) {174 function get_post_permalink( $id = 0, $leavename = false, $sample = false ) { 175 175 global $wp_rewrite; 176 176 … … 184 184 $slug = $post->post_name; 185 185 186 if ( !empty($post_link) && ( ( isset($post->post_status) && 'draft' != $post->post_status && 'pending' != $post->post_status ) || $sample ) ) { 186 $draft_or_pending = 'draft' == $post->post_status || 'pending' == $post->post_status; 187 188 if ( !empty($post_link) && ( ( isset($post->post_status) && !$draft_or_pending ) || $sample ) ) { 187 189 $post_link = ( $leavename ) ? $post_link : str_replace("%$post->post_type%", $slug, $post_link); 188 190 $post_link = home_url( user_trailingslashit($post_link) ); 189 191 } else { 190 192 $post_type = get_post_type_object($post->post_type); 191 if ( $post_type->query_var && ( isset($post->post_status) && 'draft' != $post->post_status && 'pending' != $post->post_status) )192 $post_link = "?$post_type->query_var=$slug";193 if ( $post_type->query_var && ( isset($post->post_status) && !$draft_or_pending ) ) 194 $post_link = add_query_arg($post_type->query_var, $slug, ''); 193 195 else 194 $post_link = "?post_type=$post->post_type&p=$post->ID";196 $post_link = add_query_arg(array('post_type' => $post->post_type, 'p' => $post->ID), ''); 195 197 $post_link = home_url($post_link); 196 198 }
Note: See TracChangeset
for help on using the changeset viewer.