WordPress.org

Ready to get started?Download WordPress

Forums

Broken Link Checker
Show all Anchor Text linking to a URL (1 post)

  1. Jason Wilson
    Member
    Posted 1 year ago #

    I wanted the feature of being able to see the anchor text for all links to a given page to make sure they were not all the same. I wrote the following patch:

    Replace the function in includes/admin/table-printer.php:

    function column_new_link_text($link, $instances) {
                if (empty($instances)) {
                    echo '<em>N/A</em>';
                } else {
                    // $instance = reset($instances); /** @var blcLinkInstance $instance */
                    // echo $instance->ui_get_link_text();
                    $instanceList = array();
                    foreach ($instances as $instance) {
                        $instanceList[] = $instance->ui_get_link_text();
                    }
    
                    usort($instanceList, 'strcasecmp');
                    foreach ($instanceList as $instance) {
                        echo '<span class="linkText">' . $instance . '</span>';
                    }
                }
            }

    And add a bit of CSS to css/links-page.css
    span.linkText {clear:both;display: block}

    Perhaps such functionality could be added to a future release.
    Or, maybe I'm barking up the wrong tree here and there is a simpler way to do it.

    http://wordpress.org/extend/plugins/broken-link-checker/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic