# WordPress Maintenance ## Duplicate Page Fixes ### myretonmarquees.co.uk (2026-08-09) **Problem:** Ahrefs flagged 21 duplicate pages (HS 17). **Root cause:** - 4 pages with "-2" suffix (WordPress auto-creates duplicates on slug conflict) - 5 legal pages with template content (terms-of-use, disclaimer, etc.) - 16 category archives indexed **Fixes applied:** 1. `rank_math_robots = ["noindex"]` on legal pages 2. Category archives noindexed via filter in `functions.php` 3. Canonical URLs set on "-2" pages 4. Sitemap regenerated, rewrite rules flushed **Code added to functions.php:** ```php // Noindex all category archive pages to prevent duplicate content global $wp_query; add_filter("rank_math/helpers/noindex_tax_archive", function($noindex, $tax) { return true; }, 10, 2); ``` ### Preventing "-2" duplicates in the future When recreating pages with existing slugs: 1. Delete the old page FIRST (or move to trash) 2. Then create the new page 3. This prevents WordPress from appending "-2" **WordPress CLI:** ```bash # Check for -2 duplicates wp --path=/home/domain.com/public_html --allow-root post list --post_type=page --fields=ID,post_name --format=table | grep -E '-[0-9]+$' # Fix by updating slug wp --path=/home/domain.com/public_html --allow-root post update 123 --post_name="contact-us" ``` ## PageSpeed Optimization See WordPress performance skill for PageSpeed diagnostics and fixes. ## Security - Wordfence: Check via `wp --path=/home/domain.com/public_html --allow-root wf status` - Updates: Monitor via MainWP or `wp --allow-root core update-check`