Musings about technology and other neat stuff

BrT random header image

How to fix IImage Gallery pages after update to Wordpress 2.5

May 13th, 2008 · No Comments

In one of my private blogs, I use the excellent IImage Gallery plugin to show photographs. After the upgrade to Wordpress 2.5, all of the posts with galleries started failing by showing the message “There is no gallery in this post”. After puzzling about it for a while, I realized that this plugin uses the same [gallery] tag used by the new built-in gallery feature in WP 2.5, which is causing a conflict. Fortunately, IImage Gallery also allows using <gallery>, with angle brackets, which is not intercepted by WP. To change all the posts to use the alternate tag without having to edit each post by hand, I used the following command from the MySQL command line:

update blog_posts set post_content=replace(replace(post_content, '[gallery]', '<gallery>'), '[/gallery]', '</gallery>') where post_content like '%[gallery]%';

After this, all the posts worked correctly again!

Tags: · ·