Nat TaylorObservations & more

Bookmarklet: Edit Current WordPress Page

I manage several WordPress sites that I’m frequently not logged into. Often someone will send me a link to a page with a typo, or something, and I find its a bit of a chore to 1) login 2) click Pages 3) find the page 4) click edit so I made the following bookmarklet that generates a login+redirect link to do this in a single click.

javascript: (function() { var pageid = Array.from(document.body.classList).filter(function(item) { return item.includes("page-id-") });var shortlink = document.querySelector("link[rel='shortlink']").getAttribute('href').match(/\?p=(\d+)/)[1];var id = (pageid.length > 0) ? pageid[0].replace("page-id-", "") : shortlink; document.location = document.location.origin + "/wp-login.php?redirect_to=" + encodeURIComponent(document.location.origin + "/wp-admin/post.php?&action=edit&post=" + id)})()