Skip to main content

Pathauto D10/D11: Upgrading the Delete Action for Safer Alias Cleanup

· 5 min read
Victor Jimenez
Software Engineer & AI Agent Builder

I shipped a Drupal 10/11-safe Pathauto delete action because alias cleanup is exactly the kind of workflow that quietly breaks during major-version transitions.

TL;DR — 30 second version
  • Modernized the Pathauto DeleteAction plugin with attributes + dependency injection for D10/D11
  • Updated the deriver so generated action derivatives include entity type for VBO compatibility
  • Added kernel tests for derivative IDs, type metadata, and end-to-end alias deletion
  • Also: Gutenberg release cadence is fast enough that deprecation readiness should be routine maintenance

Why I Built It

Path alias cleanup sounds simple until you run it in bulk operations, across entity types, in mixed environments that are already moving to Drupal 11 and preparing for WordPress 7.0-era editor changes.

The real problem was compatibility and predictability:

  • Action plugins needed modernization for current Drupal patterns.
  • Derivatives needed to expose entity type cleanly for VBO behavior.
  • Safety mattered more than cleverness, because bad alias deletes are hard to unwind.

If this layer is shaky, editors lose trust in automation and teams fall back to manual cleanup.

The Solution

I implemented a D10/D11-compatible DeleteAction plugin with attributes plus dependency injection, then updated the deriver so generated action derivatives include entity type for VBO compatibility.

Key Implementation Files

src/Plugin/Action/DeleteAction.php
// D10/D11-compatible action plugin with attributes + DI
// Handles bulk alias deletion via VBO
src/Plugin/Deriver/EntityUrlAliasDeleteActionDeriver.php
// Deriver exposes entity type in derivative definitions
// Critical for VBO compatibility

I also added a kernel test that validates:

  • Derivative IDs are generated as expected.
  • Derivative definitions include correct type metadata.
  • Alias deletion behavior works end to end for the action path.
tests/src/Kernel/PathautoKernelTest.php
// Validates derivative generation, type metadata, and deletion behavior
Test Environment

Kernel tests here still depend on having a full Drupal test harness available. In lightweight repo contexts, bootstrap gaps can block execution even when code quality checks pass.

Top Takeaway

This is not just a refactor. It protects a high-impact editorial operation from subtle breakage during framework upgrades. Add derivative-focused kernel tests whenever you touch action plugins that participate in bulk operations.

The Code

View Code

Key files:

  • src/Plugin/Action/DeleteAction.php
  • src/Plugin/Deriver/EntityUrlAliasDeleteActionDeriver.php
  • tests/src/Kernel/PathautoKernelTest.php
  • pathauto.permissions.yml

Other Signals

Context

On the WordPress side, Gutenberg release cadence (22.3, 22.4, 22.5 and WordPress 7.0) is fast enough that deprecation readiness should be treated like routine maintenance, not a last-minute migration task.

  • Pathauto remains a better default than custom alias-delete plumbing when you need maintained behavior in Drupal 10/11.
  • For one-off editorial UX needs, check maintained contrib first: char_counter and pagenotfound_redirect can save significant custom work.
  • ruffle is a reminder to isolate legacy content concerns instead of contaminating modern rendering paths.

What I Learned

  • Pathauto remains a better default than custom alias-delete plumbing when you need maintained behavior in Drupal 10/11.
  • For one-off editorial UX needs, check maintained contrib first: char_counter and pagenotfound_redirect can save significant custom work.
  • ruffle is a reminder to isolate legacy content concerns instead of contaminating modern rendering paths.
  • On the WordPress side, Gutenberg release cadence is fast enough that deprecation readiness should be treated like routine maintenance, not a last-minute migration task.
  • Worth trying: add derivative-focused kernel tests whenever you touch action plugins that participate in bulk operations.
  • Avoid in production: shipping action/deriver rewrites without permission and derivative coverage, because failure modes show up at content-operations scale.

Signal Summary

TopicSignalActionPriority
Pathauto DeleteActionBroken during D10/D11 transitionModernize with attributes + DIHigh
VBO DerivativesMissing entity type metadataUpdate deriver to include typeHigh
Gutenberg CadenceFast deprecation cycleTreat deprecation readiness as routineMedium
Contrib Moduleschar_counter, pagenotfound_redirectCheck before building customLow

Why this matters for Drupal and WordPress

Drupal teams relying on Pathauto for URL alias management need this D10/D11-safe delete action to avoid silent bulk-operation failures when upgrading, especially on sites with thousands of content nodes and complex alias patterns. WordPress teams managing permalinks through plugins like Yoast or Redirection face similar upgrade-fragility risks when WordPress major versions deprecate rewrite APIs. The Gutenberg deprecation cadence (22.3 through 7.0) discussed in this post is a direct signal for WordPress plugin maintainers to treat deprecation readiness as routine maintenance rather than a last-minute scramble.

References


Looking for an Architect who doesn't just write code, but builds the AI systems that multiply your team's output? View my enterprise CMS case studies at victorjimenezdev.github.io or connect with me on LinkedIn.