WP Manifestindependent plugin directory
manifest / utilities / slug-manager

Coinflip Slug Manager

A WordPress plugin to manage front-end URL slugs for Custom Post Types and Taxonomies — no code changes needed.

by Coinflip · github.com/adnan051/slug-manager · website

1stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/adnan051/slug-manager/archive/refs/heads/main.zip

A lightweight WordPress plugin that lets you change the front-end URL slugs of any Custom Post Type (CPT) or Taxonomy — straight from the WordPress admin, without touching a single line of code.


✨ Features

Feature Details
CPT Slug Control Change the URL base of any public, non-builtin post type
Per-CPT Taxonomy Slugs Set a different slug for a taxonomy based on which CPT it's attached to
301 Redirect Tracking Old slugs are automatically 301-redirected to new ones — no broken links
Live Preview URLs See exactly how the URL will look before you save
Auto Flush Rewrite rules are flushed automatically after saving
Manual Flush Button One-click fallback if URLs still 404 after saving
WooCommerce-aware Skips WC post types and taxonomies entirely
ACF-aware Ignores ACF internal post types
Sorted UI CPTs and taxonomies are displayed alphabetically

📋 Requirements

  • WordPress 6.0+
  • PHP 8.0+
  • Tested with WooCommerce and ACF (Advanced Custom Fields)

🚀 Installation

Option A — Upload via WordPress Admin

  1. Download this repository as a .zip file (Code → Download ZIP).
  2. Go to Plugins → Add New → Upload Plugin.
  3. Upload the .zip and click Install Now → Activate.

Option B — Manual Upload via FTP/SSH

  1. Clone or download this repository.
  2. Upload the coinflip-slug-manager folder to /wp-content/plugins/.
  3. Activate the plugin from Plugins → Installed Plugins.

Option C — WP-CLI

wp plugin install https://github.com/your-username/coinflip-slug-manager/archive/refs/heads/main.zip --activate

🛠 Usage

  1. Go to Settings → Slug Manager in the WordPress admin.
  2. Find the CPT or Taxonomy you want to change.
  3. Type the new slug in the New Slug column.
  4. Check the live Preview URL to confirm it looks right.
  5. Click 💾 Save All Changes.

Rewrite rules are flushed automatically. If you see 404 errors, click 🔄 Flush Rewrite Rules Manually at the bottom of the page.


🗂 How It Works

WordPress Register → Plugin intercepts args → Applies saved slug → Rewrites updated
                                                     ↓
                               Old slug stored → 301 redirect fires on template_redirect
  • CPT slugs are applied via the register_post_type_args filter (priority 999).
  • Taxonomy slugs are applied via register_taxonomy_args (priority 999) and term_link.
  • Old slug redirects are stored in wp_options and processed on template_redirect (priority 1, before theme).
  • Rewrite flush runs on init at priority 99999 to ensure all post types/taxonomies are already registered.

⚙️ Options Stored

Option Key Contents
coinflip_custom_slugs Array of CPT slugs and per-CPT taxonomy slugs
coinflip_old_slugs_redirects Map of old-slug → /new-slug/ for 301s
coinflip_slugs_need_flush Flag: 1 triggers a rewrite flush on next init

❓ FAQ

Q: Will old URLs break?
A: No. Old slugs are automatically 301-redirected to the new ones.

Q: Does this work with WooCommerce?
A: Yes — WooCommerce post types (product, shop_order, etc.) and taxonomies (product_cat, product_tag, etc.) are intentionally excluded so this plugin never interferes with WooCommerce's own URL handling.

Q: Can I reset a slug back to the original?
A: Clear the field (leave it blank) and save. The plugin will fall back to WordPress's registered default.

Q: I'm seeing 404s after saving. What do I do?
A: Click 🔄 Flush Rewrite Rules Manually at the bottom of the Slug Manager page. If that doesn't help, go to Settings → Permalinks and just click Save (a built-in WordPress flush).

Q: Does it work with hierarchical taxonomies (sub-categories)?
A: Yes. Hierarchical terms are preserved in the URL path (/new-slug/parent-term/child-term/).


📁 File Structure

coinflip-slug-manager/
├── coinflip-slug-manager.php   ← Main plugin file (everything lives here)
├── README.md
├── CHANGELOG.md
└── .gitignore

📝 Changelog

See CHANGELOG.md.


🤝 Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you'd like to change.

  1. Fork the repo
  2. Create your feature branch: git checkout -b feature/my-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin feature/my-feature
  5. Open a Pull Request

📄 License

GPL-2.0-or-later — same as WordPress itself.