Inbound links entire site

The Inbound links entire site function is used to find other posts on the website that contain links (URLs) pointing to a specific post. The result is a list of posts linking to the target post, along with details such as the post title, category, and the anchor text of those links.

How It Works:

For example, if you have Post A and want to know which other posts on the site contain a link to Post A, this function will:

  • Loop through all posts.

  • Find posts that contain the URL of Post A.

  • If found, it records the post title, category, and the clickable text (anchor text) of those links.

Specific Example

Suppose you have the following posts:

  • Post A: "How to Take Care of Houseplants"

  • Post B: "Guide to Houseplant Care for Beginners" (contains a link pointing to Post A)

  • Post C: "Benefits of Indoor Plants" (also contains a link pointing to Post A)

When calling Inbound links entire site with the ID of Post A, the returned result would look like this:

[
    [
        'ID'          => 2, // ID of Post B
        'title'       => 'Guide to Houseplant Care for Beginners',
        'type'        => 'post',
        'categories'  => 'Guides, Houseplants',
        'anchor_text' => 'see more about houseplants',
    ],
    [
        'ID'          => 3, // ID of Post C
        'title'       => 'Benefits of Indoor Plants',
        'type'        => 'post',
        'categories'  => 'Benefits, Houseplants',
        'anchor_text' => 'learn more here',
    ],
]

Summary

This function helps you identify which posts contain links to a specific post, making it useful for analyzing internal links or SEO purposes.

Last updated