Site logo

Archived topic

site-title link goes to '/wp' instead of '/'

3 replies · Started by Neil on February 3, 2021

Viewing posts 1–4 of 4

Hi there,

Can you try this instead?

add_action( 'after_setup_theme', 'tu_navigation_as_header' );
function tu_navigation_as_header() {
	remove_action( 'generate_header', 'generate_construct_header' );
	add_action( 'generate_inside_navigation', 'tu_site_title_navigation' );
}

function tu_site_title_navigation() {
    ?>
	<div class="site-branding">
		<p class="main-title" itemprop="headline">
			<a href="<?php echo home_url('/'); ?>" rel="home">
				<?php bloginfo( 'name' ); ?>
			</a>
		</p>
	</div>
    <?php
}

We simply changed site_url(); to home_url('/');.

site_url() takes the path you've added on WordPress Address (URL) while home_url() takes the Site address (URL) set in your General Settings.

Thanks Elvin! That worked.

Nice one. Glad it worked for you. No problem. :)

This archived topic is closed to new replies.