(Partial Solution) WordPress “Press This” tool generates 404 errors

Wordpress Tips

If you enjoy the Facebook bookmarklet for adding a quick post to Facebook, you’ve probably used the “Press This” tool from WordPress, or tried to. When it works right, it opens a pop-up window containing a quick post form. There’s a bug in this bookmarklet, however, that makes it sometimes generate a 404 error.

Reading the forums, this seems to come and go maybe on a version basis, so its not a very reliable tool. There are plenty of fixes around, but none of them worked for me. So I hacked a partial solution.

Modifying the “Press This” Bookmarklet

The fix is pretty simple. Create your “Press This” bookmark by dragging the link from the Tools > Tools page in WordPress to the bookmark or favorites toolbar in your browser. After you’ve created your bookmark, click it and see if it works. It should open a pop-up with the title of the page you had open when you clicked it as the post title and a link to the URL with its title as the link text. If you’re not logged into WordPress, it will ask you to log in first.

If you instead get a 404 error in the pop-up, close the pop-up, then right-click the bookmark and select “Properties”.

In the “Location” line there will be a long javascript string. If you can’t see the whole string, you may have to select it all and paste it into a text file for editing then paste it back later. Once you can see that long javascript string, find this:

u='+e(l.href)+

and replace it with this:

u='+e(l.href.replace("http://",""))+

My code modification only fixes the bookmarklet for URLs that start with http:// so I call it a partial fix. URLs that start with https:// still cause the error.

I’m not so sure this is a drastic error because most https:// (encrypted) pages are behind a password and probably aren’t good candidates for posting anyway.

The Error

When you drag the “Press This” bookmarklet to your bookmarks or favorites toolbar it creates a bookmark with a long string of javascript as the location. This bookmarklet is supposed to open the press-this.php file in your WordPress admin folder in a pop-up window with the URL you want to post in a quick press form along with the title of the URL you’re trying to post. Somehow it munges the URL you’re wanting to post and causes the 404 error.

“Press This” can be valuable. You don’t have to keep a WordPress window open while you’re working on other things. Just click the bookmarklet and you get a quick press form in no time flat.

If “Press This” is something you’d like to use, but couldn’t, this hack works for URLs that start with http:// so I guess it’s a start

View Comments

One Response to (Partial Solution) WordPress “Press This” tool generates 404 errors

Leave a Reply