# Pixellize Site Issue Scanner

**Version:** 0.5  
**Author:** [Pixellize](https://pixellize.io)  
**License:** GPLv2 or later  
**Requires WordPress:** 6.2 
**Tested up to:** 7.0

Powerful SEO auditor by Pixellize. Crawls your site to fix broken links, missing meta tags, and unoptimized images.

---

## Description

Pixellize Site Issue Scanner is a comprehensive toolkit designed to improve your website's health and search engine performance. By performing deep site audits, it identifies critical issues that impact user experience and search rankings.

---

## Features

### 🔍 Precision SEO Audit
- **Meta Tag Integrity** — Detects missing, short, or excessively long Meta Titles and Descriptions.
- **Heading Hierarchy** — Flags missing H1 tags, multiple H1 tags, and skipped heading levels.
- **Indexation Monitoring** — Identifies pages hidden from search engines via `noindex` tags.
- **Sitemap Verification** — Multi-method check for `sitemap.xml`, `sitemap_index.xml`, and `robots.txt` entries.
- **Canonical Tag Audit** — Flags pages missing a `<link rel="canonical">` tag, pages with multiple conflicting canonicals, and canonicals that point to a different URL or domain than the page itself. One-click Edit Canonical popup writes to Yoast, Rank Math, AIOSEO, and SEO Framework meta keys.
- **Open Graph + Twitter Card Audit** — Detects missing `og:title`, `og:image`, `twitter:card`, `twitter:image`, and og:image dimensions below the recommended 1200x630 (uses declared meta tags or fetches the image once and caches the result for 24 hours).

### 🔗 Link & Asset Guardian
- **Internal & External Links** — Validates every link on your site, identifying 404 errors and unreachable URLs.
- **Redirect Mapping** — Flags 301/302 redirects to help minimize hops and save crawl budget.
- **Critical Asset Health** — Monitors JavaScript, CSS, and iframes for availability and load errors.
- **External Link Best Practices** — Identifies external links missing `target="_blank"` or security attributes.

### 🖼️ Image Optimization
- **Broken Image Detection** — Finds images that fail to load from your server or external CDNs.
- **Accessibility Check** — Flags missing `alt` attributes critical for screen readers and SEO.
- **Missing Dimensions** — Detects images without `width`/`height` attributes to prevent Layout Shifts (CLS).
- **Oversized Assets** — Highlights images exceeding 250KB that slow down page loads.

### 🚀 Actionable Fixes
- **Integrated Meta Editor** — Edit Meta Titles and Descriptions with real-time character counting. Syncs with Yoast, Rank Math, AIOSEO, and more.
- **Add Alt Text Across All Pages** — Saves alt text to the Media Library and updates every page/post where that image is used. Skips images that already have alt text. Gutenberg-safe via regex (no DOMDocument mangling). Works reliably on localhost via 4-fallback attachment lookup.
- **Bulk Find & Replace** — Safely replace broken URLs across post content, meta fields, and serialized option data.
- **One-Click `target="_blank"`** — Automatically update external links to open in a new tab.
- **Noindex Removal** — Quickly toggle off the `noindex` tag for pages that should be visible to search engines.

### 📊 Intelligent Dashboard
- **Site Health Score** — Bird's-eye view of your website's overall health using `100 - (issues_per_page × 10)` formula.
- **Real-Time Crawling** — Watch the crawler navigate your site asynchronously with pause/resume support.
- **Resume After Crash** — Crawl progress is persisted in `wp_options` (`pixellize_active_crawl`), so a closed tab or page reload shows a resume banner with single-click recovery instead of losing the scan.
- **Diff Between Scans** — Each report shows how many issues are new and how many were fixed since the previous scan, keyed on `(page_url, issue_type, element_url)` tuples.
- **Issue Breakdown** — Categorized reports with "How to Fix" guidance for every error or warning.
- **Recent Reports** — Per-batch history showing date, pages scanned, error count, and health score.
- **CSV Export** — Professional CSV reports of all identified issues.

### ⚙️ Advanced Configuration
- **Post Types** — Restrict crawling to Posts and Pages.
- **Post Statuses** — Choose between Publish, Draft, and Private.
- **Max Pages to Crawl** — Set a crawl limit per scan (blank = unlimited).

---

## Installation

1. Upload the `pixellize-site-issue-scanner` folder to `/wp-content/plugins/`.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Access the dashboard via the **Site Problems** menu item in the admin sidebar.

---

## Changelog

### 0.5 *(Latest)*

- Tested with WordPress 7.0.
- Bumped minimum WordPress to 6.2 and declared Requires PHP 7.4 in plugin header and readme.
- Hardened ajax_dismiss_review with a manage_options capability check.
- Hardened all direct database queries flagged by Plugin Check. Table identifiers now pass through $wpdb->prepare() using the %i placeholder. Inlined the hardcoded error-type IN list to remove the last interpolated placeholder string. uninstall.php DROP TABLE call uses the same prepared pattern.
- Configurable crawl concurrency. Worker-pool refactor in the JS crawler lets the page fetch rate be tuned via a single CRAWL_CONCURRENCY constant.
- Live log streams completed URLs one at a time. Green line when clean, orange line when issues were found.
- Recent Reports on the dashboard now lists every scan, including scans where every page failed to load.

### 0.4

**New SEO checks**
- **Canonical Tag Audit** — Detects missing, conflicting, or mismatched canonical link tags. One-click Edit Canonical popup writes to Yoast, Rank Math, AIOSEO, and SEO Framework.
- **Open Graph and Twitter card audit** — Flags missing `og:title`, `og:image`, `twitter:card`, `twitter:image`, and og:image dimensions below 1200x630.

**Crawl reliability + reporting**
- **Resume After Crash** — Crawl state is saved to the database every few pages, so a closed tab or page reload shows a Resume banner instead of losing progress.
- **Diff Between Scans** — Each report shows how many issues are new and how many were fixed since the previous scan.
- **Live elapsed-time timer** in the crawl progress area.
- **Crawl duration** displayed on Dashboard Recent Reports.
- **Bulk select + Delete Selected** on Settings page Report Management.
- **Review prompt** at the top of plugin pages, dismissible per user.

**Faster crawl**
- URL list cached 5 minutes so repeat scans start instantly.
- Sitemap detection moved to a non-blocking background call. HEAD checks replace GET so the first scan no longer waits on slow responses.
- Issues buffered per page and written with a single multi-row INSERT.
- Asset and link timeouts shortened to 8-10 seconds.
- Well-known reliable CDNs (Google Fonts, jsDelivr, cdnjs, jQuery CDN, Bootstrap CDN, Font Awesome, Gravatar, etc.) skipped from broken-status checks.

**UI**
- Drill-down report header shows the current issue title and subtitle with a back button on the right.
- Recent Reports rendered as a clean table on the Dashboard.
- How-to-Fix guide moved above the report wrap.
- Find and Replace modal header changed from purple gradient to solid black.
- Start Full Scan and Stop buttons toggle visibility (no more greyed-out states).
- Crawl status text hidden in favor of timer and page-count indicators.

**Fixes and removals**
- Pages with a noindex tag are no longer flagged for missing canonical.
- Crawl Mode setting removed (plugin always runs Full Crawl).
- Delete All Data Forever Danger Zone removed (bulk select replaces it).
- Export CSV button and Duration column removed from Settings Report Management table.

### 0.3
- **Fix:** Bug fixes and stability improvements.

### 0.2
- **UI/UX:** Full flat-design overhaul — 4-card stats grid; redesigned report tables, modals, and drill-down pages.
- **UI/UX:** Toast notifications replace old inline alerts; Recent Reports show date + time.
- **UI/UX:** Pixellize branding footer added to all admin pages.
- **Feature:** Configurable Max Pages to Crawl (default 25; blank = unlimited); Settings page redesigned with Post Types (Posts & Pages) and Post Statuses (Publish, Draft, Private) options.
- **Feature:** Add Alt Text updates all pages/posts where the image is used and skips images that already have alt text.
- **Feature:** Issues count in Report Management shows only errors, matching Dashboard numbers exactly.
- **Fix:** Site Health Score no longer shows 0 — uses correct formula and scanned-page denominator.
- **Fix:** Dashboard Recent Reports now shows correct data and scores for each batch.
- **Fix:** CSV export corruption resolved; nonce verification added.
- **Fix:** Relative internal links no longer cause false 404 reports.

### 0.1
- Initial release with crawler engine, sitemap detection, external link fixer, image dimension resolution, and meta tag editor.

---

## License

This plugin is licensed under the [GPLv2 or later](https://www.gnu.org/licenses/gpl-2.0.html).

---

Made with ♥ by [Pixellize](https://pixellize.io)
