WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am developing a plugin for WordPress 3.5. My blog's default title is "Test". Here is some code of my plugin:

add_filter('wp_title', 'my_replace_title');

function my_replace_title(){
    return get_option('my_site_title');

The new title is "my website title". But it's out putting the result:

"my website titleTest"

How to replace old title with new title?

share|improve this question
To which title are you referring: 1. Site Title, 2. Page Title, 3. Post Title ? – Brian Fegter Dec 26 '12 at 21:20
Make sure the Test part is not hard-coded in your theme. – toscho Dec 26 '12 at 21:21
@BrianFegter Site Title – Seek Php Dec 26 '12 at 21:25

Please try this code hope it will solve your problem.

add_filter( 'wp_title', 'theme_custom_title', 20 );

function theme_custom_title $title ) {
    return str_replace('your old title', 'your New title', $title); 
// changes the "Enter title here" to "Enter some New title" 
add_filter('gettext', 'custom_rewrites', 10, 4);

function custom_rewrites($translation, $text, $domain) {
    global $post;
    $translations = &get_translations_for_domain($domain);
    $translation_array = array();
    switch ($post->post_type) {
        case 'videofaqs':
            $translation_array = array(
                'Enter title here' => 'Enter Video question here'
    if (array_key_exists($text, $translation_array)) {
        return $translations->translate($translation_array[$text]);
    return $translation;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.