Removing onsite links

The theme creates some internal links (coming from the source code .php file) which I would like to remove for SEO purpose.

For instance:

  • Skip to content
  • Archive links

Can you tell me how I could possible remove those links by using a custom.pho function?

Thank you!

Hello there,

To remove the “Skip to content” link, you need to replicate the header.php template file from main theme to your child theme. In your child theme, remove the below line:


<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'sydney' ); ?></a>

Archive links

How did you recognize this link on your site? Could you please share me a link where I can identify it?

Regards,
Kharis

Hello Kharis !

Appreciate it. That helps. However, I am not using a child theme. Instead, I want to use:
myCustomFunctions

That plugin allows to customize any .php file.

However, I never used it before and I was wondering, what code I have to put into the editor in order to remove the Skip to content URL - removing the code you mentioned above.

How to do that ?

@Archive links:
To answer your question: How did I recognize the links?

I usually scrape every Domain and it’s page. After scraping I am getting a report that shows me all internal links. Outgoing, onsite links, linked by, linked to, etc.

After that… I just simple check the source code of it’s page.
And there I found the links, I simple don’t want to have, like the Archive links…

Step by step… first, let’s focus on removing Skip to Content with the MyCustomFunction Editor.

Thank you!

first, let’s focus on removing Skip to Content with the MyCustomFunction Editor.

That link resides in the header.php template file. To remove it from your site, you need to copy this file into your child theme. Then you can safely remove this code:


<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'sydney' ); ?></a

Regards,
Kharis

Kharis,

Did you read my post outlining that I am not using a child theme!!!

Hello there,

There is no other route than using a child theme to remove that “skip link”.

You might be interested to read an information why we should use a child theme to modify the parent theme. Please visit the below links:

Regards,
Kharis

There is no way to use the custom function editor?

No, I am afraid.

Technically custom function is written to overwrite other function. As that “skip link” is not written in a function, we can’t use custom function.

If you haven’t yet created a child theme, you can use our premade one, which might be good starting point for you.

Regards,
Kharis

What would be the consequence of removing that line <?php _e( ‘Skip to content’, ‘sydney’ ); ?>
in the child theme ?

Hello @yadihinz,

The skip to content link is adopted from the site accessibility recommendation which has been standardized by the WordPress accessibility team. The default themes (such as Twenty Seventeen) do this as well. You can read more about it on this accessibility handbook.

If you remove it your site would be less accessible; it won’t break your site though.

Regards,
Kharis