WordPress.org

Make WordPress Core

Changeset 13549


Ignore:
Timestamp:
03/02/10 11:57:32 (5 years ago)
Author:
dd32
Message:

Add a 'pre_post_link' filter to get_permalink() before token replacement occurs. Fixes #12240

File:
1 edited

Legend:

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

    r13527 r13549  
    101101    } 
    102102 
    103     if ( empty($post->ID) ) return false; 
     103    if ( empty($post->ID) ) 
     104        return false; 
    104105 
    105106    if ( $post->post_type == 'page' ) 
     
    111112 
    112113    $permalink = get_option('permalink_structure'); 
     114 
     115    $permalink = apply_filters('pre_post_link', $permalink, $post, $leavename); 
    113116 
    114117    if ( '' != $permalink && !in_array($post->post_status, array('draft', 'pending', 'auto-draft')) ) { 
     
    155158        $permalink = home_url( str_replace($rewritecode, $rewritereplace, $permalink) ); 
    156159        $permalink = user_trailingslashit($permalink, 'single'); 
    157         return apply_filters('post_link', $permalink, $post, $leavename); 
    158160    } else { // if they're not using the fancy permalink option 
    159161        $permalink = home_url('?p=' . $post->ID); 
    160         return apply_filters('post_link', $permalink, $post, $leavename); 
    161     } 
     162    } 
     163    return apply_filters('post_link', $permalink, $post, $leavename); 
    162164} 
    163165 
Note: See TracChangeset for help on using the changeset viewer.