Skip to content

Link tag attributes "data-type" and "data-id" missing #17035

@GrosserRichardUBL

Description

@GrosserRichardUBL
  • I've read and understood the contribution guidelines.
  • I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened.

When we add an internal link to a wordpress page inline (see https://wordpress.com/support/links/#method-one-the-link-button, second gif), the generated html tag has no attributes data-type="page" and data-id="<id>" with Yoast SEO activated.

Please describe what you expected to happen and why.

The html tag for the link has the attributes data-type="page" and data-id="<id>", because this is WordPress default. Having the attributes attached is crucial when using the rest api in a consuming application. E.g. in a single page application, such a link has to be modified to trigger a callback function that is fetching the content of the linked page instead of including the link as is. Without the information, that the link is a link to an internal page with a known id, it is hard to decide for the spa how to handle it. Corresponding support topic: https://wordpress.org/support/topic/link-tag-attributes-missing/

How can we reproduce this behavior?

  1. Create a page in WordPress named "Foo"
  2. Create another page "Bar" in the same WordPress instance with a text block in it and insert a link to the page "Foo" by using the page link selection in the editor (see https://wordpress.com/support/links/#method-one-the-link-button, second gif)
  3. Look at the html of the page "Bar" in the frontend: the link tag to "Foo" has the attributes data-type and data-id in it, when Yoast SEO was deactivated while creating the link (= WordPress default) and the attributes are missing, when Yoast SEO was activated.

Technical info

  • If relevant, which editor is affected (or editors):
  • Classic Editor
  • Gutenberg
  • Classic Editor plugin
  • Which browser is affected (or browsers):
  • Chrome
  • Firefox
  • Safari
  • Other

Used versions

  • WordPress version:
  • Yoast SEO version:
  • Gutenberg plugin version:
  • Classic Editor plugin version:
  • Relevant plugins in case of a bug:
  • Tested with theme:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions