How to change the site title link in WordPress
The site name that's displayed in the header of your site is also a link to the homepage of your WordPress site. If you want to change the link associated with this site title, you can do this with a simple code modification. You need to edit the header.php file of your theme.
If your application is installed directly in the public_html folder on your WordPress hosting account, the path to the file will be public_html/wp-content/themes/theme_name/header.php (of course, theme_name should be replaced with the actual name of the theme). In the file find a string of code that looks like this:<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
The example code above is taken from one of the default themes that comes prepackaged with the installation package. Depending on the theme that you use it may be a bit different.
The part of the code that you need to edit is:
a href="<?php echo esc_url( home_url( '/' ) ); ?>"
Replace the code that's between the quotation marks with the full URL address of the desired link so that it looks like this:
You can edit the file from the Files section of the Pixie control panel. Another way to do it is to download it on your local computer with an FTP client (e.g. FileZilla), edit it with a text editor (e.g. Notepad, Wordpad) and upload it back replacing the old file.
Keep in mind that code modifications to theme files will be lost when you update that theme. To avoid this you can create a child theme of the original one and set it to be the current theme. Then just copy the header.php file from the original theme and paste it into the folder of the child theme, and edit the copied file. For more information check out the tutorial on creating a child theme in WordPress.
You may also find useful the other articles on modifying the header:
- how to change the site title in WordPress
- how to change the tagline in WordPress
- how to remove or display the site title and the tagline in WordPress
- how to change the font style, size and color of the site name and tagline in WordPress
- how to move the site title and tagline within the header in WordPress
- how to add or change the header image in WordPress
Was this answer helpful?
- How to add and edit static pages in WordPress
- How to show post counts in "Categories" and "Archives" menus in WordPress
- How to change the font family, size and color of the site title and the tagline in WordPress
- How to change the site name in WordPress
- How to remove "Proudly powered by WordPress" from the footer in WordPress