• We’ve been trying to add a hook to include post thumbnails in our RSS feed. While the code we had in place looked correct the thumbnails weren’t showing up at all.

    After much scouring of our install I traced the problem to podPress. podpress.php includes

    add_filter('get_attached_file', 'podPress_get_attached_file');

    and the definition of the podPress_get_attached_file function is

    function podPress_get_attached_file($file, $id = '') {
            if ( is_feed() ) { return ''; }
            return $file;
    }

    Removing that hook solved our problem.

    What is the purpose of that hook, and is there any way to refine it to be more targetted? I’m happy to help with a patch but don’t want to dive in until I know the reasoning behind the hook.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter jystewart

    (@jystewart)

    I should say that my solution in the short term is to remove the filter before running my code, and then re-adding it after I’ve got what I need. Hardly ideal, but it works.

    Plugin Author ntm

    (@ntm)

    That is an relative old function of podPress and I don’t know why (and by whom) it was build into podPress. I’m also not familiar with the filter 'get_attached_file'.
    But I will look into this matter in the next days.

    It might be possible that this filter is not really necessary and if it so, I will remove or modify this filter in one of the next versions.

    Regards,
    Tim

    Plugin Author ntm

    (@ntm)

    I have deactivated this filter in podPress 8.8.9.2. I have looked through all the files of podPress. But the only purpose I can imagine is to prevent WP from adding non-podPress enclosures to Feed items. Since 8.8.5 podPress has a different filter to achieve that.

    get_attached_file and wp_get_attachment_metadata are filter hooks for the file name of a attachment and the meta information of the attachment. But podPress attachments are probably in the most cases no WP attachments. That is why they don’t appear in the WP media library. (To add the media files to the media library one could use for instance the plugin Add From Server.)
    podPress stores the information of the media files in the postmeta db table – but with own meta_key names and not with _wp_attachment_metadata or _wp_attached_file as meta_key. podPress does not use get_attached_file() and wp_get_attachment_metadata() and it most likely no problem if data of WP attachments end up in elements of a Feed.

    So thank you for making me aware of these filters. They will stay de-active until further notice.

    Regards,
    Tim

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘podPress_get_attached_file overwriting attempts to include thumbnail in feed’ is closed to new replies.