Skip to main content

Have Link Health check the links your add-on keeps — a guest’s publications

Premium Intermediate Outlinks

benecaster_outlinks_health_guest_links is a filter, ( array $links ): array. Outlinks applies it once per Link Health check, in the background scan, starting from []. Guest Manager adds every published guest’s publication links that are not tracked with Outlinks (a tracked one is checked as a tracked link); use the filter for links your own add-on keeps.

Return a list of [ 'guest_id' => int, 'url' => string ], where guest_id is the published guest the link is on. Entries that are not arrays, have no positive guest_id or are not http or https are skipped, and one URL on one guest is one item however often it is listed. Link Health’s excluded domains apply.

The items appear on Settings → Link Health with the source Guest, the guest’s name and a link to edit the guest, read from benecaster_guest_manager_get_guest() when the page loads (without an answer, the guest post’s title and no link). They have no show, so a show filter lists none of them. They can be dismissed and restored. Update URL, Unlink and Create outlink are refused with benecaster_outlinks_action_unsupported (This link is in a guest’s profile. Correct it in Guest Manager.), because the link lives in Guest Manager’s data, which Outlinks never writes. The email digest names one Link … in the publications of guest ….

Code

<?php
add_filter( 'benecaster_outlinks_health_guest_links', function ( array $links ): array {
    foreach ( my_addon_guests_with_publications() as $guest_id => $publications ) {
        foreach ( $publications as $publication ) {
            if ( empty( $publication['outlinks_id'] ) ) {
                $links[] = [ 'guest_id' => $guest_id, 'url' => $publication['url'] ];
            }
        }
    }
    return $links;
} );

View on GitHub →

Hooks Used

Need this built rather than just documented? See our services →