Outbound links entire site

The Outbound links entire site function identifies links from a specified post that point to other posts or pages within the same website. This helps you understand how your content connects to other content, which can enhance user experience and SEO.

How It Works:

  • Retrieve Post Content: It gets the content of the specified post and looks for any links within that content.

  • Identify Internal Links: The function scans through the content to find standard anchor links (HTML links) that point to other internal posts (links that start with your site's home URL). It gathers the post IDs, titles, categories, and the text used in the links (anchor text).

  • Identify Shortcode Links: It also looks for specific shortcode links related to the post content. These are special placeholders that can link to other posts. It collects similar information for these links as well.

  • Store and Return Results: Finally, it compiles the found links and returns a list of outbound links along with their details.

Specific Example:

Post A: "How to Grow Roses" contains:

  • A link to Post B titled "Best Fertilizers for Roses."

  • A shortcode linking to another post titled "Common Rose Diseases."

[
    [
        'ID'          => 5,  // ID of Post B ("Best Fertilizers for Roses")
        'title'       => 'Best Fertilizers for Roses',
        'type'        => 'post',
        'categories'  => 'Gardening, Flowers',
        'anchor_text' => 'Read more about fertilizers',
    ],
    [
        'ID'          => 6,  // ID of "Common Rose Diseases"
        'title'       => 'Common Rose Diseases',
        'type'        => 'post',
        'categories'  => 'Gardening, Flowers',
        'anchor_text' => 'Learn about rose diseases',
    ],
]

Summary:

This function helps you discover which internal links are pointing from a specific post to other content on your website. By identifying these links, you can better understand content relationships, improve your internal linking strategy, and enhance user navigation throughout your site.

Last updated