我有两个函数可以执行相同的操作:它们为过期的帖子添加标题前缀。以下哪项功能对站点性能的影响更大?
function expired_facebook_events_title_prefix_( $title, $id = null ) {
if( is_singular( \'facebook_events\' ) && \'expired\' == get_post_status() && in_the_loop() ) {
return \'[expirat] \' . $title;
}
return $title;
}
add_filter(\'the_title\', \'expired_facebook_events_title_prefix_\', 10, 2);
function expired_facebook_events_title_prefix( $title ) {
global $post;
if( $post->post_type == \'facebook_events\' && $post->post_status == \'expired\' && in_the_loop() ){
return \'[expirat] \' . $title;
}
return $title;
}
add_filter( \'the_title\', \'expired_facebook_events_title_prefix\' );