I have two functions that do the same action: they add a title prefix for expired posts. Which of these functions will affect more the site performance?
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' );