Make WordPress Core

Opened 15 months ago

Last modified 2 months ago

#23367 assigned enhancement

Remove message parameters fron admin URl's in the browser address bar

Reported by: mark-k Owned by: VarunAgw
Milestone: Awaiting Review Priority: low
Severity: minor Version:
Component: Administration Keywords: good-first-bug has-patch
Focuses: administration Cc:


Scenario: When a post is being published successfully "message=6" is appended to the URL. If I refresh the page while in that state I will get the "post published" message again, although nothing was done.

There is probably nothing functionally wrong with the way things work now but it can be esthetically more pleasant if that parameter was removed which in turn will eliminate the message problem.

This can be done on browsers that support the history API of HTML5. The following piece of code can be used after displaying the message or maybe it can be generalized to work in the admin footer.

<script type="text/javascript" charset="utf-8">
  url = the canonical URL for the address
  if (typeof history.replaceState === 'function') { // check html5 functionality support
    data = {dummy:true};

Attachments (2)

src.diff (1.4 KB) - added by VarunAgw 2 months ago.
Code required for fix
common.js.patch (1.6 KB) - added by VarunAgw 2 months ago.

Download all attachments as: .zip

Change History (7)

comment:1 johnbillion2 months ago

  • Component changed from General to Administration
  • Focuses administration added
  • Keywords needs-patch good-first-bug added
  • Priority changed from normal to low

This seems like a sane idea. We should introduce a JavaScript version of remove_query_arg() to remove the unwanted query vars from the current URL. Here's a starting point for the default list of vars to remove.

Any takers?

Last edited 2 months ago by johnbillion (previous) (diff)

comment:2 VarunAgw2 months ago

  • Keywords needs-patch removed

I have created a patch for this. I am unsure where to add this. I think maybe wp-admin/js/common.js but I am not sure. I have attached it.

VarunAgw2 months ago

Code required for fix

comment:3 nacin2 months ago

  • Owner set to VarunAgw
  • Status changed from new to assigned

Hi VarunAgw: common.js seems like a good place, yep!

VarunAgw2 months ago

comment:4 VarunAgw2 months ago

  • Keywords has-patch added

comment:5 ircbot2 months ago

This ticket was mentioned in IRC in #wordpress-dev by VarunAgw. View the logs.

Note: See TracTickets for help on using tickets.