WordPress: mass edit 'Allow Pings' fields with SQL

I’d previously closed pinging for all ancient posts to prevent trackback spam, but after installing Akismet my blogs have ceased to suffer from it, so I decided it was time to re-open them.

Took me some time to find the appropriate SQL spells, but I finally came across the right ones at WP’s support forums: by applying btvillarin’s SQL instructions I was able to achieve somewhat the reverse of what he was aiming at:

UPDATE wp_posts
SET ping_status = "open"
WHERE ping_status = "closed";

This causes all posts with their ping status currently closed be changed so that they’re once again open for pings.

Note that you might have to replace wp_posts in the above with yourtableprefix_posts, in case you have changed the default table prefix.

WordPress and JavaScript links: use Text Control!

When writing the previous post, WordPress was seriously trying to prevent me from publishing a link with ‘javascript’ as its protocol (<a href=”javascript:the actual JavaScript was here“>…</a>). As publishing that link was, kinda, the point of the post, I had to make it work.

WordPress Codex’s Using Javascript told me to try a plugin called Text Control, so I installed it, and with No Formatting and No Character Encoding selected, the JavaScript link came to life.

Improving blosxom's bookmarklet for wikieditish

Tatsuhiko Miyagawa’s bookmarklet is a plugin for use with another Blosxom plugin, wikieditish. I’m relying heavily on the tiny bit of javascript provided by the bookmarklet on my linkblog, and came up with a small improvement.

The script already (at v.0.03) picks up any selection made by the user, and uses that for a title.
0){void(window.open(‘$blosxom::url’+path+’.wikieditish?bookmarklet=1&title=’+escape(d.title)+’&url=’+escape(d.location.href)+’&quote=’+escape(t),’_blank’,”))};”>My version uses the same data to fill in the prompt for entry path with a reasonable default; it is converted to lowercase and then all the whitespaces are replaced with dashes. The resulting path resembles that of WordPress’ so-called Pretty permalinks.

Replacing changed directory names with .htaccess

After poking around with some Rewrite rules and nearly losing my nerve with what seemed to be a choice between a 500 Internal Error and WordPress’ 404 pages, I finally came up with a redirect instruction for my .htaccess file that replaces a subdirectory name in URLs which end in .html.

I need this because when I started marginaali, I used Blogger which outputs html files. I then moved on to WordPress and imported everything I had blogged thus far – apart from the comments that I had received. Therefore I didn’t have the heart to delete all those .html files and was sort of stuck between the two.

After activating pretty permalinks, all requests to those old posts were redirected to the WordPress ones, and so the comments were, in effect, not available. Not until I changed the old posts’ directory name from both Blogger’s and WordPress’ standard naming by the year, by prefixing the (thankfully only) 2004 directory with an ‘o’, into ‘o2004’.

There was one additional problem: that of old links out there in the Net pointing to these old posts and the comments in them – they were now broken of course. Here’s where I figured a relatively simple rewrite rule should do the trick: in all requests to files ending in .html under /marginaali/, replace the 2004 with the o2004.

Well, like I implied in the beginning, this was surprisingly difficult to achieve with my little experience in tweaking .htaccess files. I finally succeeded, however, and here’s my solution:

RedirectMatch /marginaali/2004/(.*)\.html$ http://mummila.net/marginaali/o2004/$1.html

I placed this directive after the segment added by WordPress, in the the same .htaccess file that controls the permalinking, in /marginaali/. It leaves requests to the WP versions of posts (such as this one) intact, while fixing the requests to their html versions with the added ‘o’ so that, for example, 2004/11/sepe.html gets redirected to o2004/11/sepe.html. (That is an actual example of a page being referred to out on someone else’s page, which I have no control over.)

Syötevirtojen lukeminen Google Readerilla

Erkan yllytyksestä päätin kokeilla Google Readeria, ja varsin mainioltahan tämä näin ensimmäisen päivän perusteella vaikuttaa.

Tilausten siirto tähän saakka käyttämästäni BlogBridgestä kävi näppärästi, sillä Google Reader osasi tuoda ne OPML-muotoisesta tiedostosta, ja BlogBridge puolestaan osaa viedä ne sellaiseen. Ainut matkalle tipahtanut tieto olivat skandit yhden guiden (kuten BlogBridge niitä nimittää) tai hakemiston/tagin (kuten Google Reader samaa asiaa nimittää) nimestä (läjästä tuli lj), sekä tieto jo luetuiksi merkityistä teksteistä, mutta muutoin siirto meni mallikkaasti.

Tästä kaiken siirtämisestä selaimeen tulee vain se ongelma, että välilehtiä pitää jatkuvasti olla auki miljoona, ja niiden välillä sompailu alkaa jo käydä työstä. Jo tätä ennen minulla on ollut jatkuvasti auki kahdeksan vakiosivua ja niiden lisäksi erinäinen määrä (yleensä 2-4) sivuja, joille olen aikonut palata joskus lähitulevaisuudessa.