How to add an #anchor text in Wordpress

The Manual / Code Writer Way

  1. Edit or Create a Post/Page: Log in to your WordPress dashboard and navigate to the post or page where you want to add the anchor links.
  2. Switch to the Text Editor: While editing the post or page, switch to the Text Editor mode. You can find this option at the top right corner of the editor.
  3. Identify the Section to Anchor: Decide where you want to place the anchor link. For instance, if you want to create an anchor for a specific heading, place your cursor before that heading's text.
  4. Insert the Anchor Tag: Manually insert an anchor tag using the following format:

    <a name="your-anchor-name"></a>

    Replace "your-anchor-name" with a descriptive name for your anchor. Make sure to use a unique and recognizable name for each anchor.
  5. Link to the Anchor: To create a link that jumps to this anchor, use the following format:

    <a href="#your-anchor-name">Link Text</a>

    Replace "your-anchor-name" with the anchor name you set earlier and customize "Link Text" to display the clickable link text. Or select the text and click on the link option - enter
  6. Update or Publish: Once you've inserted the anchor and the linking text, switch back to the Visual Editor to see how it looks. Then, update or publish your post/page.
  7. Test the Anchor Links: View your published post/page and click on the anchor link you created to ensure it takes you to the intended section.

The Block Writer Way

  1. Write the header or the text paragraph, this is where we will point the user. Select the text that you wish you use as the anchor.
  1. Click on the link icon - this will bring a popup. Enter the name of the anchor you wish you use. Note - it must start with a hash (#) and you cannot use spaces in the name, we also recommend all lower case - e.g. #this-is-a-sample-anchor
  1. Now, we recommend at the top of the page doing a "list of contents" on "index". Create block and the text you would like to act as a link to the anchor, select it and expand the right hand side bar and block settings, enter the name exactly as you entered it above, but without the initial "#", e.g. this-is-a-sample-anchor
  1. Save your page, flush any caches, and then test.