Issue
The WPSlug (Wen Pai Su Ge) sanitize_title filter (priority 9) intercepts WordPress core’s internal sanitize_title() call inside add_menu_page(). WordPress uses this call to generate the admin page hook suffix ($admin_page_hooks[$menu_slug]).
When All-in-One WP Migration (AIOWPM) registers its menu via add_menu_page('All-in-One WP Migration', ...), the following occurs:
- Without WPSlug: hook suffix =
all-in-one-wp-migration(correct) - With WPSlug: the optimizer removes the stop word “in” → hook suffix =
all-one-wp-migration(incorrect)
AIOWPM’s enqueue_import_scripts_and_styles($hook) performs a strict stripos match against all-in-one-wp-migration_page_ai1wm_import. The altered hook fails to match → CSS/JS files are not enqueued → the import page loses all styling.
Scope of impact: Not only AIOWPM — any plugin whose menu title contains a stop word (e.g., in, on, at, to, for, of, with, by, a, an, the) is affected.
Root Cause Analysis
sanitize_title() serves two distinct purposes in WordPress:
- Content slug generation: Used when saving posts, terms, or media — requires transliteration (e.g., Chinese-to-Latin) and stop-word optimization.
- Internal identifier generation: Called during
add_menu_page()(within theadmin_menuaction) solely to produce a stable hook suffix for page identification.
WPSlug does not distinguish between these contexts, erroneously applying content-oriented optimizations to internal identifiers.
Fix Proposal
Add a doing_action() guard in processSanitizeTitle() to skip filtering during admin menu registration:
// Skip during admin menu registration — sanitize_title() is used to
// generate hook suffixes, not content slugs.
if (doing_action('admin_menu') || doing_action('network_admin_menu') || doing_action('user_admin_menu')) {
return $title;
}
Why This Is Safe
add_menu_page()callssanitize_title()during theadmin_menuaction only to generate hook suffixes — these are not content slugs and must remain unaltered.- Actual post/term slug generation never occurs during the
admin_menuaction, so there is zero risk of false negatives. - Coverage extends to
network_admin_menuanduser_admin_menu, ensuring safety in Multisite environments.
Verification Results
Tested on wapuu.com with both WPSlug and AIOWPM active:
- During
admin_menu:sanitize_title("All-in-One WP Migration")→all-in-one-wp-migration✓ (“in” preserved) - Hook matches
all-in-one-wp-migration_page_ai1wm_importexactly ✓ - Regression test: Chinese-to-Latin slug conversion remains fully functional ✓