WordPress.org

Make WordPress Core

Changeset 13023


Ignore:
Timestamp:
02/08/2010 04:23:32 PM (9 years ago)
Author:
ryan
Message:

Rename get_post_link() to get_post_permalink() to avoid conflict with bbPress. Props scribu. fixes #12172

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/link-template.php

    r12987 r13023  
    108108        return get_attachment_link($post->ID);
    109109    elseif ( in_array($post->post_type, get_post_types( array('_builtin' => false) ) ) )
    110         return get_post_link($post);
     110        return get_post_permalink($post);
    111111
    112112    $permalink = get_option('permalink_structure');
     
    172172 * @return string
    173173 */
    174 function get_post_link( $id = 0, $leavename = false, $sample = false ) {
     174function get_post_permalink( $id = 0, $leavename = false, $sample = false ) {
    175175    global $wp_rewrite;
    176176
     
    184184    $slug = $post->post_name;
    185185
    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 ) ) {
    187189        $post_link = ( $leavename ) ? $post_link : str_replace("%$post->post_type%", $slug, $post_link);
    188190        $post_link = home_url( user_trailingslashit($post_link) );
    189191    } else {
    190192        $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, '');
    193195        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), '');
    195197        $post_link = home_url($post_link);
    196198    }
Note: See TracChangeset for help on using the changeset viewer.