Skip to content

Instantly share code, notes, and snippets.

@jpluimers
Last active July 19, 2023 15:43
Show Gist options
  • Save jpluimers/751fccdb5b3c2e45773ed00872631a96 to your computer and use it in GitHub Desktop.
Save jpluimers/751fccdb5b3c2e45773ed00872631a96 to your computer and use it in GitHub Desktop.
Bookmarklet which allows me to edit the blog post I am viewing (which works for for preview and unpublished posts as well)
javascript:{ var postID = document.getElementsByName("comment_post_ID")[0]?.value; var a = document.createElement("a"); if (postID === undefined) { a.href = document.querySelector('link[rel="EditURI"]').href; var searchParams = new URLSearchParams(window.location.search); postID = searchParams.get("p");} else { a.href=HighlanderComments.connectURL; }; a.pathname='wp-admin/post.php'; a.search=`post=${postID}&action=edit&classic-editor`; a.hash=''; open(a.href); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment