• Is it possible to prevent anchors being automatically added to the heading tags in WordPress 5.7.1?

    It looks like some sort of JS is adding the HTML anchor when you edit a post.

    This is duplicating anchors in my headings added by my table of contents plugin. All my headings appears as follows:

    <h2 id="heading"><span id="Heading">Heading</span></h2>

    I would like to eliminated the anchor that appears in the heading tag.

    I am aware that my WordPress version is old. Just checking if there is a way I can resolve this without updating WordPress.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @nomadandinlove

    This has been fixed in WordPress 5.9.1. See https://www.ads-software.com/documentation/wordpress-version/version-5-9-1/ and https://github.com/WordPress/gutenberg/pull/38780

    So basically, you have three options:

    • Either update to last WordPress 6.4.2 version
    • or, if you cannot upgrade to 6.4 branch, upgrade to WordPress 5.9 branch at least (current version is 5.9.8), which is the first branch including the patch
    • or, stay on WordPress 5.7 branch if you have to, and try to install Gutenberg as a standalone plugin. This will bring the very last version of Gutenberg to your current WordPress installation. Be careful however: there’s no guarantee that WP 5.7 and Gutenberg 17.5 will work well together. Try it at your very own risk.

    In any case, prior updating WordPress or installing a plugin, make sure you back up your website and you’re able to access its files and database by means other than the WordPress dashboard.

    Finally, please note that WordPress 5.7.1 is not secure. Under no circumstances should you use it. If you must stay on the 5.7 branch for any reason, be sure to upgrade to minor version 5.7.10, which includes all security patches. Really.

    Best of luck!

    Moderator bcworkz

    (@bcworkz)

    That’s not normal behavior even in older versions AFAIK. You can of course manually linkify a heading, but it’s not done automatically. However, your theme will typically linkify post titles in archive listings, but if you are talking about H2 headings in TOCs that’s not post titles.

    The cause of auto-linking could be due to the editor you’re using. The block editor (Gutenberg) and classic editor don’t do this. Or it could be something your theme or a plugin is doing. Try deactivating all plugins and switching to a default Twenty* theme. There ought to be no auto-linking now. To isolate the cause, restore your theme and plugins one at a time until auto-linking recurs.

    You really ought to update to be sure all known security flaws have been patched. I suppose you have your reasons, but keeping out of date software is rarely a good idea. Just sayin’ ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to stop Auto HTML anchors added to heading tags’ is closed to new replies.