How to change the title of wordpress blog directly in php?

Asked

Viewed 3,335 times

4

I’m in the final stages of developing my blog on wordpress and a few months ago, when I started developing I put a título, but after many researches I decided to change it, because I found another similar - I want mine to be unique - so I decided to put another title.

I want to change the title that is right next to the favicon, ie the tag <title>

Initially changed in the Painel de Configurações / Geral / Título do Site

On the panel it shows that changed, but when I press F5, continues with the previous title.

  • I also deleted browser history because of cache, but it didn’t help.

  • I tested in the Firefox, now I’m testing in Chrome, but the title remains the same.

  • I tried to look in the file themes / o meu tema / header.php the tag <title>, but there’s no such tag on my header.

  • I tried to write a title to overwrite what already exists, but also did not work.

I searched the index, but the index calls the header.

Does anyone know where else I can find the title in the php of wordpress to change? Why the painel it’s not changing at all.

Thanks in advance.

  • Initially careful when mounting the question, a poorly formatted question can change the goal and so cause your question not to be answered. In the post you cite trying to find the tag header, didn’t want to talk head? For header is a tag intended for a header, such as the top of the site, and head contains page information, such as title then make sure you have searched for the correct tag.

  • I got it. So I looked for the header.php itself, and then looked for the head tag inside the header.php page. Because the head tag was to be inside the index, I entered the index and the index was "calling" by the header.php page. Inside the header.php page should be the head tag with the title inside. But it does not have the title, only the tag.

  • Marcielli, take a look at the edition I made in my reply.

  • @Chun I just tidied up and that was it. Thank you very much. ;)

1 answer

4


You must not have found the tag <title> in the header.php because this should probably be implemented through <?php wp_head(); ?>.

If you search the file header.php within the tag <head>, very likely you should find this syntax - <?php wp_head(); ?>, which is a function implemented in the functions.php responsible for implementing the <title>, <style> etc..

If that’s the case, to change the title just go to:

Dashboard => Settings => General => Site Title

Changes the title site for the new name you want for the site.


Editing

How are you using one Cache Plugin and of SEO (All in One SEO Pack), you also have to make changes to the new title in the SEO plugin and reset/delete the cache of the Cache Plugin.

To make the title changes in the SEO Plugin, navigate to:

All in One SEO Pack => General Settings => Home Page Settings => Home Title:

or by accessing the link: http://meusite.com/wp-admin/admin.php?page=all-in-one-seo-pack%2Faioseop_class.php%2F#aiosp_home_metabox and changes the title of Home Title: for the new title you want to define. Using this plugin will replace the site title (<title>), by the text/title you define here.

(I tested this personally).

And then you need to delete or reset the cache of the Cache Plugin, so that the updates are applied.

  • This is the case yes, I found inside the header.php page this function. However, I tried to change by Dashboard => Settings => General => Site Title, in the panel it shows that I changed from one to another, but when I update the page, it’s as if I haven’t changed the settings. Then I go back in the settings, and the new title is there.

  • What’s the theme you’re wearing?

  • I am using Oblique. Follow the link: https://wordpress.org/themes/oblique/

  • I commented on this syntax <?php wp_head(); ? > and put <title>Name of the site</title> but the same way when I gave F5 appeared the old name, even though I put the new name in the title of the syntax.

  • 1

    Even when commenting on the title continues? Before updating try to clear cookies and browser cache by pressing Ctrl + Shift + Delete

  • Yes, previously I had only deleted the cache, but now I did as you said and deleted the cookies as well. It did not help.

  • @Leonardovilarinho So when did I comment on this syntax <?php wp_head(); ? >, I put the <title>Site name</title> under another name, and the previous title continued. When I just comment, and do not put a title with another name, it appears only localhost/wordpress

  • have installed any cache plugin in Wordpress? tried deleting the plugin cache and also refresh the page using: Ctrl+F5 or Ctrl+Shift+F5. Have installed some SEO plugin for meta tags?

  • 1

    I’ve tried updating the page that way. I have installed the plugin All in One SEO Pack, until at the beginning I thought it was him, because when I created the homepage, just below asks for the title of SEO, but I edited the page and in it is a different title, so in that I know it is not. So, maybe it can be the tag, as you said... I’ll look. And About the Cache plugin, I have one. I’ll look it up because I haven’t found it yet. Thanks for your attention. ;)

  • @Marciellioliveira could change the line <?php wp_head(); ?> for <?php var_dump(wp_head()); ?>? When updating the page it should write a code at the top of the blog, so you could send the code to us, and it becomes easier to detect the error.

  • @Leonardovilarinho Yes, I did that and NULL appeared.

  • Very strange, according to the wordpress documentation the function wp_head should return part of the head page. But digging into the documentation I also found the wp_title that returns the blog title, and in an example of the documentation itself, you can put <title><?php wp_title(); ?></title> to change the title, if it does not work by placing after the <?php wp_head(); ?> try to delete the line and try only with the wp_title

  • 1

    Very strange indeed. I tried to put after wp_head and there was no change. So I just put <title><? php wp_title(); ? ></title> and defaced the entire page. I’ll keep looking and if I find anything, put here. Thanks for the attention @Leonardovilarinho

  • 1

    @Chun Thank you very much, that was it! I just tidied up here. This is my first blog, I’m still learning. Something so simple to get ready and without your help I would definitely stay a long time trying to solve... rs Thanks really! ;)

Show 9 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.