How can I filter blog name?

I want to filter the blog’s name for Google’s user agents.

I have tried the_title, the_content, comment_text, single_post_title, wp_title, category_description, bloginfo hooks, but none of them worked!

Can anybody help me?

2 Answers
2

The value is from get_option('blogname'), so you can filter pre_option_blogname:

add_filter( 'pre_option_blogname', 'wpse_78345_blogname' );

function wpse_78345_blogname()
{
    return 'Haha!';
}

Do not filter option_blogname. This is wrong: you are wasting time with that, because WordPress will parse the option cache for the stored result, and then you don’t even use it.

Leave a Comment