• Resolved wpwebdevj

    (@wpwebdevj)


    Before installing Rank Math, internal links created with Gutenberg look like this:

    <a href="URL" data-type="post" data-id="xxx">Text</a>

    After installing Rank Math, internal links crated with Gutenberg look like this:

    <a class="rank-math-link" href="URL">Text</a>

    Why is class=”rank-math-link” added? (this happens with both internal and external links).

    Why is Rank Math removing the data-type and data-id attributes for internal links?

    All the internal links created before installing Rank Math have the data-type and data-id attribute with no class. All the internal links created after installing Rank Math are missing these attributes but instead have class=”rank-math-link” added.

    What is the purpose class=”rank-math-link”? If this is needed then what about all of the existing links created before installing Rank Math? If it’s not needed, then how to remove it?

    What about the data-type and data-id attributes? What is the purpose of these attributes and why is Rank Math removing them?

    • This topic was modified 3 years, 5 months ago by wpwebdevj.
    • This topic was modified 3 years, 5 months ago by wpwebdevj.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Rank Math

    (@rankmath)

    Hello @wpwebdevj

    Thank you for contacting the support and sorry for not following up quickly and any inconvenience that might have been caused due to that.

    In Rank Math, we overwrite the Gutenberg’s link module in order to add the nofollow & sponsored attribute. The rank-math-link is a unique class which is needed to overwrite the default module. You` can use following filter to remove the rank-math-link class:
    https://rankmath.com/kb/filters-hooks-api-developer/#remove-rank-math-link-class

    What about the data-type and data-id attributes? What is the purpose of these attributes and why is Rank Math removing them?
    We do not add this attribute. Please confirm by disabling Rank Math if they are still getting added.

    Hope that helps.

    Thread Starter wpwebdevj

    (@wpwebdevj)

    Hi,

    Thanks for the reply. Better late than never!

    Regarding the data-type and data-id attributes, these are added by default when creating an internal link with the block editor (gutenberg).

    My question is why Rank Math is removing these attributes?

    On a new installation of WordPress without any plugins installed, this is what the code for an internal link looks like on the front end.

    <p>Here is an <a href="http://www.example.com/?p=1" data-type="post" data-id="1">internal link</a>.</p>

    After installing Rank Math, the original link is unchanged, but any new link looks like this.

    <p>Here is another <a href="http://www.example.com/?p=1" class="rank-math-link">internal link</a> with Rankmath installed.</p>

    As you can see, there are 2 differences between the links created before and after installing Rank Math.

    1. The data-type and data-id attributes are missing.
    2. class=”rank-math-link” is added.

    The filter hook does indeed remove the class-“rank-math-link” from the front end, but the data attributes are still missing (the data-type and data-id attributes included by default with the gutenberg link module).

    Now the problem is that all the existing internal links from before I installed Rank Math have these 2 attributes and all the new internal links created after installing Rank Math don’t have them.

    If I deactivate the Rank Math plugin then the links are still the same as above and it’s now impossible to remove the class=”rank-math-link” from the front end when Rank Math is deactivated.

    Plugin Author Rank Math

    (@rankmath)

    Hello @wpwebdevj

    Sorry for not following up quickly and any inconvenience that might have been caused due to that.

    It seems like we need to change the behavior in the Rank Math plugin.

    We have reported the issue internally and it should be fixed in one of the upcoming updates.

    We will inform you as soon as the update is out.

    In the meantime, if there’s anything else we can help you with, please let us know.

    We are here to assist. Thank you.

    Plugin Author Rank Math

    (@rankmath)

    Hello @wpwebdevj

    Thank you for your patience.

    This issue was fixed in one of the latest updates.

    Please update everything on your website, including all the plugins, themes & WordPress.

    Hope that helps.

    If not, please open a new support topic or reply to this one and we will be more than happy to assist.

    Take care!

    Hi @rankmath

    I updated your plugin (Rank Math SEO free version) to latest version (1.0.55) and problem still exists.

    For example here is html anchor when plugin is deactivated:
    <a href="https://twitter.com/intent/tweet" data-op3-element-container="" data-op3-twitter-via="" data-op3-twitter-url="http://mashine.local/socialsharingcustomurl/"></a>

    and here is after I activated plugin:
    <a href="https://twitter.com/intent/tweet" data-op3-twitter-via="" data-op3-twitter-url="" rel="noopener"></a>

    For some reason data-op3-element-container attribute is removed.

    Plugin Author Rank Math

    (@rankmath)

    Hello,

    Thank you for your patience.

    We have released an update that should fix the potential issue(s) you were facing.

    Please update to the latest versions of Rank Math & Rank Math PRO.

    Hope that helps. If there’s anything else we can help you with, please let us know. We are here to assist.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Strange behavior when creating links with Gutenberg when Rank Math is enabled’ is closed to new replies.