Close Menu

Adding a “nofollow” Attribute to a Button in WordPress

When creating links on your WordPress site, you may want to add a “nofollow” attribute to certain buttons to indicate to search engines that the link should not influence the ranking of the linked page. This is particularly useful for sponsored or affiliate links. Here’s how you can add a “nofollow” attribute to a button in WordPress:

Step 1: Create or Edit a Button

  1. In your WordPress dashboard, navigate to the page or post where you want to add the button.
  2. Click on the “Edit” button to open the page or post in the WordPress editor.
  3. If you haven’t already created the button, you can do so using the WordPress button block or by using a button shortcode provided by your theme or a plugin.

Step 2: Switch to the Text Editor

  1. In the WordPress editor, click on the three dots in the top-right corner and select “code editor”.
  2. This will allow you to view and edit the HTML code of your page or post.

Step 3: Locate the Button Code

  1. In the text editor, find the HTML code for the button you want to add the “nofollow” attribute to.
  2. The button code will typically look something like this:

<a href=”” class=”button”>Button Text</a>

Step 4: Add the “nofollow” Attribute

  1. To add the “nofollow” attribute to the button, you need to modify the HTML code slightly.
  2. Add rel=”nofollow” inside the opening <a> tag, like this:

<a href=”” class=”button” rel=”nofollow”>Button Text</a>

  1. The rel=”nofollow” attribute tells search engines that the link should not pass any link equity or influence the ranking of the linked page.

Step 5: Save the Changes

  1. After adding the “nofollow” attribute to the button code, click on the “Update” or “Publish” button to save the changes.
  2. Your button will now have the “nofollow” attribute applied, and search engines will be instructed not to follow the link.

That’s it! You’ve successfully added a “nofollow” attribute to a button in WordPress.