Knowledgebase

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:

a href="http://yourdomain.com"

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:

Was this answer helpful?

 Print this Article

Also Read