Skip to main content

Read a show’s Outlinks click report from code — people, filtered clicks, last click and clicks by episode

Premium Intermediate

GET /benecaster-outlinks/v1/shows/{show_id}/report is the route the Show Settings → Outlinks tab’s table reads. It needs manage_options (send an X-WP-Nonce for wp_rest from a browser) and Outlinks on for {show_id}, else 403 benecaster_outlinks_not_active.

It answers { items, link_health }, one item per tracked link of the show. Each item has id, slug, label, reference_id, destination_url, go_url, clicks, bot_clicks, last_clicked_at, last_clicked, episodes (each { episode_id, title, clicks }), status and http_status.

  • clicks, last_clicked_at and each episode’s clicks count people only; bot_clicks counts the filtered clicks. A crawler visit never moves last_clicked_at.
  • last_clicked_at is ISO 8601 UTC (2026-10-21T10:30:00Z), for sorting; last_clicked is the same moment in the site’s date and time format, for showing. Both are null until a person clicks.
  • label is the Reference Library item’s label, or null for a standalone link or a blank label.
  • episodes is most clicks first. An episode_id of null groups clicks that named no episode; a deleted episode keeps its id and is titled Deleted episode #ID. title is raw, so escape it when you print it.
  • status is the link’s Link Health status: healthy, broken, expired, unchecked or excluded, with the saved exclusions applied. A link dismissed in Link Health still reports its real status here. http_status is the code of its worst counted check, null when none answered or none has run.
  • link_health is site-wide, not the show’s. broken counts every show’s broken tracked links and broken site links, leaving out dismissed and excluded ones (the same count as the Link Health notice), and page_url is the Settings → Link Health page.

Code

<?php
$request  = new WP_REST_Request( 'GET', '/benecaster-outlinks/v1/shows/12/report' );
$response = rest_do_request( $request ); // As a user with manage_options.

foreach ( $response->get_data()['items'] as $link ) {
    printf( "%s: %d people, %d filtered\n", esc_html( $link['label'] ?? $link['slug'] ), $link['clicks'], $link['bot_clicks'] );
}

View on GitHub →

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