When Focus Mode first came out in LearnDash 3.0, you could add your logo to the header of Focus Mode, but it didn’t link anywhere. It was just a static image.

LearnDash Focus Mode header image example

Starting in LearnDash 3.1, the logo now automatically links back to your site’s homepage. Personally, I see this as an improvement, but… what if you want it to link somewhere else? Or remove the link entirely and go back to how it was prior to 3.1 (not recommended)?

I’ll walk you through the steps on how to change the URL of the LearnDash Focus Mode logo, as well as provide a few examples.


If you already know how to use WordPress filter hooks, and just want the code:

Using a LearnDash Filter

To change the logo URL, we’re going to use one of the built-in “filters” that LearnDash provides. In short, this allows us to modify some of LearnDash’s HTML code before it gets output onto the page. It’s a safe way to make small changes to a LearnDash-powered site.

Code Snippets Plugin

My preferred way to make changes like this is with the Code Snippets plugin. You could also add this code to the functions.php file of your child theme (if you’re using one), but I find Code Snippets to be easier to manage and less likely to bring your site down if you make a mistake.

  1. Install & activate “Code Snippets” from your WordPress plugins page
  2. Navigate to Snippets > Add New in the left sidebar
  3. Give your snippet a name
  4. Paste one of the following code snippets into the Code area
  5. Choose the Only run on site front-end option
  6. Click the Save Changes and Activate button

Link to the Course Page

This is the most common scenario I’ve seen requested so far. If you want the Focus Mode logo to link back to the course page that the student is currently in, use the following code:

add_filter( 'learndash_focus_header_logo_url', function( $header_logo_url = '', $course_id = 0, $user_id = 0 ) {
	$header_logo_url = esc_url( get_permalink( $course_id ) );

	return $header_logo_url;
}, 30, 3 );

This will automatically detect which course the lesson/topic/quiz is a part of, and use the appropriate URL for that specific course.

Use a Completely Custom URL

Perhaps you want to link the logo to the user’s profile page, a WooCommerce account page, or any other page on your WordPress site. Simply navigate to that page on the front-end of your site, copy the URL, and paste it in the code below, replacing CUSTOM_URL.

Be sure to use the full URL, including https://.

add_filter( 'learndash_focus_header_logo_url', function( $header_logo_url = '', $course_id = 0, $user_id = 0 ) {
	$header_logo_url = 'CUSTOM_URL';

	return $header_logo_url;
}, 30, 3 );

Unlike the course page option above, which changes dynamically based on which lesson/topic/quiz the student is viewing, this URL will be used for all lessons, topics & quizzes, for all courses.

While I don’t recommend this option, you might want to remove the link entirely, and just display the logo image. If this is the case, use the following code:

add_filter( 'learndash_focus_header_logo_url', function( $header_logo_url = '', $course_id = 0, $user_id = 0 ) {
	$header_logo_url = '';

	return $header_logo_url;
}, 30, 3 );

Different URLs for Different Courses

If you want to get really clever, you could technically use a different link for each course. I can’t think of too many real-world scenarios where this would be useful, but hey, prove me wrong and tell me about it in the comments 😜.

You will need to know the ID of your courses, but we have a tutorial on how to find your course ID here.

In the code below, replace 1 with the ID of one of your courses. Then replace CUSTOM_URL with the URL you want the logo to link to when viewing any lesson/topic/quiz within that course.

Do the same with the 2 below.

You can add as many of these as you’d like, but keep in mind, less code is beautiful code. Don’t overdo it.

add_filter( 'learndash_focus_header_logo_url', function( $header_logo_url = '', $course_id = 0, $user_id = 0 ) {

	if( $course_id == 1 ) {
	
		$header_logo_url = 'CUSTOM_URL';
	
	}

	if( $course_id == 2 ) {
	
		$header_logo_url = 'CUSTOM_URL';
	
	}

	return $header_logo_url;
}, 30, 3 );

That should cover most scenarios for where you might want to link your Focus Mode logo URL, but if you have any other ideas, please let me know in the comments.