A lightweight WordPress plugin that periodically scans your content for broken links and displays them in an easy-to-use dashboard widget. Perfect for maintaining site health and SEO.
- Automatic Scanning: Weekly cron job scans all published posts and pages
- Manual Scan: Run scans on-demand with a single click
- Dashboard Widget: Quick overview of broken links on the main dashboard
- URL Validation: Uses
wp_remote_head()to check link status - Detailed Reports: View broken links with post titles, URLs, and status codes
- Configurable Frequency: Choose between daily, twice daily, or weekly scans
- Post Type Selection: Scan posts, pages, or any custom post type
- Timeout Control: Adjust request timeout (5-30 seconds)
- Search & Filter: Quickly find specific broken links
- Click to Copy: Click any URL to copy it to clipboard
- Responsive Design: Mobile-friendly admin interface
- WPCS Compliant: Follows WordPress coding standards
- Upload the
yt-broken-link-checker-litefolder to the/wp-content/plugins/directory - Activate the plugin through the 'Plugins' menu in WordPress
- Go to Tools → Broken Links to view results and configure settings
- Check the dashboard widget for a quick overview
- Plugin activates and schedules a weekly cron job
- Cron runs at the scheduled interval
- Scans all posts of selected post types
- Extracts URLs from post content (links and images)
- Checks each URL using
wp_remote_head() - Stores broken links in WordPress options
- Displays results in dashboard widget and admin page
- Uses
wp_remote_head()for HEAD requests (faster than full GET) - Follows redirects (up to 5 hops)
- Configurable timeout (default: 10 seconds)
- Checks both
<a>tags (href) and<img>tags (src) - Only checks external URLs (starting with
http://orhttps://)
- 200-399: Link is working ✓
- 400-599: Link is broken ✗
- Error: Network error or timeout
Navigate to Tools → Broken Links to see:
-
Statistics:
- Total broken links found
- When last scan was performed
- Time until next scheduled scan
-
Results Table:
- Post/Page title with edit link
- Broken URL
- HTTP status code or error message
- Quick action to edit the post
-
Dashboard Widget:
- Shows up to 5 broken links
- Link to view all results
- Last scan time
- Go to Tools → Broken Links
- Click "Scan Now" button
- Wait for scan to complete (may take a while for many posts)
- View results
Scan Frequency:
- Daily: Scans once per day
- Twice Daily: Scans every 12 hours
- Weekly: Scans once per week (default)
Post Types to Scan:
- Select which post types to check
- Default: Posts and Pages
- Works with custom post types
Request Timeout:
- How long to wait for a response
- Range: 5-30 seconds
- Default: 10 seconds
Click "Clear Results" button to remove all broken link data. Useful after fixing links or for a fresh start.
yt-broken-link-checker-lite/
├── class-yt-broken-link-checker-lite.php # Main plugin file (~650 lines)
├── assets/
│ ├── css/
│ │ └── yt-blc-admin.css # Admin UI styles
│ └── js/
│ └── yt-blc-admin.js # Admin interactions
└── README.md # This file
All functions, classes, and elements use the yt_blc prefix:
- Class:
YT_Broken_Link_Checker_Lite - Constants:
YT_BROKEN_LINK_CHECKER_* - Functions:
yt_blc_* - CSS Classes:
.yt-blc-* - JavaScript Object:
ytBlcAdmin - Cron Hook:
yt_blc_scan_links - Options:
yt_blc_options,yt_blc_broken_links,yt_blc_last_scan - Text Domain:
yt-broken-link-checker-lite
The plugin stores data in WordPress options (no custom tables):
-
yt_blc_options: Plugin settings
array( 'scan_frequency' => 'weekly', 'post_types' => array('post', 'page'), 'timeout' => 10 )
-
yt_blc_broken_links: Array of broken links
array( array( 'post_id' => 123, 'url' => 'https://example.com/broken', 'status_code' => 404, 'error' => '' ), // ... more broken links )
-
yt_blc_last_scan: Unix timestamp of last scan
// On activation
wp_schedule_event( time(), 'weekly', 'yt_blc_scan_links' );
// Hook
add_action( 'yt_blc_scan_links', 'scan_all_links' );daily: Once per daytwicedaily: Every 12 hoursweekly: Once per week
When you change the frequency in settings:
- Old cron schedule is cleared
- New cron schedule is created
- Takes effect immediately
- Capability Checks: All admin actions require
manage_options - Nonce Verification: CSRF protection on all forms
- Input Sanitization: All inputs sanitized before storage
- Output Escaping: All output properly escaped
- Safe HTTP Requests: Uses
wp_remote_head()with timeouts - User Agent: Custom user agent for identification
- Uses HEAD requests (faster than GET)
- Processes posts sequentially
- Configurable timeout prevents hanging
- Only scans published posts
- Caches results until next scan
- Cron job runs in background: Doesn't affect front-end
- No database tables: Uses standard WordPress options
- Minimal queries: Loads all posts once, then processes
- Throttled requests: Respects timeout settings
- Reduce post types: Only scan necessary post types
- Increase timeout: For slow external sites
- Less frequent scans: Weekly instead of daily
- Exclude old posts: Manually if needed (custom code)
WordPress cron requires site visits to trigger. If your site has low traffic:
- Use a real cron job (server-level)
- Use a plugin like WP Crontrol
- Set up external monitoring service
If scans never complete:
- Increase PHP max_execution_time
- Reduce number of post types
- Increase request timeout
- Run manual scans during off-peak hours
Some sites may block automated requests:
- Check manually to verify
- Some sites require specific headers
- Firewall may block the server's IP
- Rate limiting may cause temporary failures
The plugin extracts links from:
<a href="...">tags<img src="...">tags
It does NOT check:
- Links in shortcodes (unless they render)
- JavaScript-generated links
- Links in custom fields
- Links in widgets
- Schedule during low traffic: Choose frequency based on site traffic
- Review regularly: Check dashboard widget weekly
- Fix promptly: Broken links hurt SEO and user experience
- Export data: Screenshot or note broken links before fixing
- Re-scan after fixes: Verify links are now working
- Monitor patterns: Repeated broken links may indicate an issue
- HEAD requests only: Some servers don't support HEAD properly
- No link statistics: Doesn't track when links broke
- No notifications: Doesn't email about broken links
- No link editing: Must manually edit posts
- No link replacement: Can't find and replace links
- No external link management: Just detection, not management
- Email notifications
- Link statistics/history
- Bulk link editing
- Link replacement
- External site monitoring
- API integration
- Custom headers for requests
- Proxy support
When the plugin is deleted via WordPress admin:
- All plugin options are removed
- Cron job is cleared
- WordPress cache is flushed
- No data is left behind
- WordPress 5.8 or higher
- PHP 7.4 or higher
- Server must allow outgoing HTTP requests
wp_cronmust be working (or real cron setup)
- Main PHP File: ~650 lines (with comments)
- CSS File: ~170 lines
- JS File: ~145 lines
- Total: ~965 lines across all files
For most sites, weekly is sufficient. High-traffic sites or sites with frequently changing content may benefit from daily scans.
No! The scanning happens in the background via cron and doesn't affect your front-end performance.
Not directly through the plugin. You would need to add a post with that URL and run a scan.
When you delete a post, its broken links remain in the results until the next scan or until you clear results.
Not currently. You can copy the data from the admin page or use a screenshot.
No, it only checks external links (starting with http:// or https://). Internal links should always work if your site is configured correctly.
No, it only scans the main post content (post_content). Custom fields and meta data are not checked.
Not through the plugin UI. You can modify the cron schedule using WP-CLI or a cron management plugin.
- Initial release
- Weekly automated scanning
- Dashboard widget
- Manual scan option
- Configurable scan frequency
- Post type selection
- Request timeout control
- Search and filter functionality
- Click to copy URLs
- Responsive admin design
GPL v2 or later
Krasen Slavov
- Website: https://krasenslavov.com
- GitHub: https://github.com/krasenslavov
For issues and feature requests, please visit the GitHub repository.
Potential features for future versions:
- Email notifications for broken links
- Link editing/replacement interface
- Link statistics and history
- Bulk link operations
- Custom HTTP headers support
- Exclude specific URLs or domains
- REST API endpoints
- White-label reporting
- Integration with Google Search Console
- Link monitoring dashboard