Get album_id by media_id


I’m tying to hook onto rtmedia_after_delete_media action call to execute an external cache purge routine. This function will be purging cache content for several pages including<gallery_id>. But the do_action() in RTMediaMedia.php (function delete(), line 291) is passing only the $id.
Is there away to get the album_id by the media_id?


Hi Anton,

Yes, that id will be no longer is use once media was deleted.

You can use $rtmedia_query global variable in that hook and can access $rtmedia_query->media array which holds all the detail of media which was deleted.

Hi and thanks a million for your response!!

Works like a charm!


Hi Anton,

I am glad to know that your issue is resolved :slight_smile: