[wp-hackers] Need Custom Post Type Rewrite Help, Please

Mike Schinkel mikeschinkel at newclarity.net
Sun Apr 18 21:52:06 UTC 2010


On Apr 18, 2010, at 3:45 PM, scribu wrote:
>> add_filter('post_type_link','
>> wbt_post_type_link',10,3);
>> function wbt_post_type_link($link, $id, $leavename) {
>>       if (strpos($link,'financial-terms/')!==false)
>>               $link = str_replace('financial-terms/','',$link);
>>       return $link;
>> }
> 
> I would replace
> 
>       if (strpos($link,'financial-terms/')!==false)
> 
> with
> 
>       if ( 'financial-term' == get_post_type($id) )

Perfect! Thanks.

-Mike


More information about the wp-hackers mailing list