Skip to content

Use removable_query_args instead of standard argument passing when appropriate #23498

Description

@pls78

While working on Add "Edit with Yoast Bulk Editor" entry to WP admin content-type bulk-actions dropdown - ph2 I came across removable_query_args, which is a WordPress filter that allows you to strip certain arguments from a page URL once the page received it. This allows for cleaner URLs where irrelevant parameters (e.g. parameter that make sense for a single request, or for internal use only) are stripped. Pure cosmetics, but why not? 🙂

Claude identified the following points in our code where this approach could be implemented:
Yoast SEO:

  1. redirected_from_site_kitsrc/dashboard/user-interface/setup/setup-flow-interceptor.php:83 redirects to wpseo_dashboard&redirected_from_site_kit; it feeds isRedirectedFromSiteKit (site-kit.php:191), which renders SiteKitRedirectBackAlert in the dashboard widget. Refresh or bookmark keeps showing the "welcome back from Site Kit" alert forever.
    2. wpseo_tracked_action + wpseo_tracking_nonce — task-list links carry them (tracking-link-adapter.php); tracking-on-page-load-integration.php fires the tracker on admin_init. They linger, so every refresh re-runs the tracking path and bookmarks/shared URLs embed a tracking action + nonce. Both names would need registering (core's list covers _wpnonce-style params it knows, not custom nonce names).
  2. start-myyoast-connection + _wpnonce — the JS hand-rolls exactly what the filter does: myyoast-integration.js:421 calls removeSearchParam twice + addHistoryState. Registering both params would let core's wp_admin_canonical_url() do it and the custom scrub could go. Caveat: the JS removes them at a deliberate moment (after auto-start kicks off); worth checking the flow tolerates load-time scrubbing before swapping.
  3. install=true (addon-installation dialog, dialog-integration.php:70) — while it's in the URL, every refresh re-busts the MyYoast addon-info cache and reopens the dialog. Scrubbing after first load is arguably the desired UX, but it's a product call (a user who refreshes mid-flow loses the dialog).
  4. from_tools=1 (redirect-integration.php:89 → redirects page) — only switches an upsell link variant (modal-content.js:21).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions