Archive for the ‘bugfix’ Category

Fixing the Upload section when using Podpress

Friday, November 16th, 2007

PodPress introduces a bug whereby the Upload file browser no longer recognizes image fiiles as images, and therefore does not produce the <img> tag needed to display the image in a post.

Luckily, this can be fixed from within another WP Plugin, using the following snippet:

/*
**    Fix podpress' bug that affects WP's upload field
*/
function dsc_pp_attached_file_bug ($file, $id='') {
   if (preg_match("/upload\.php/", $_SERVER['PHP_SELF']))
      remove_filter('get_attached_file',
         'podPress_get_attached_file');
   return $file;
}
function dsc_pp_get_attachment_metadata_bug ($data, $id='') {
   if (preg_match("/upload\.php/", $_SERVER['PHP_SELF']))
      remove_filter('wp_get_attachment_metadata',
         'podPress_wp_get_attachment_metadata');
   return $data;
}
add_filter('wp_get_attachment_metadata',
   'dsc_pp_get_attachment_metadata_bug', 9, 2);
add_filter('get_attached_file',
   'dsc_pp_attached_file_bug', 9, 2);

The above code removes the filters introduced by PodPress when we’re in WP’s own Upload field.

PodPress is showing more and more annoying little features/bugs - it’s a pretty code rich plugin that does alot.