Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to create a plugin to prevent duplicate attachments from XMLRPC calls "metaWeblog.newMediaObject". The idea is, before wp_insert_attachment function is called, you generate a unique hash of the file, and check against the database. Each attachment insert will save the unique hash of the file. If there is a match, then don't save the same file and return the guid of the existing file.

However, I can't seem to be able to find a hook for wp_insert_attachment. Looking through the function, there are no do_action or do_filter for me to hook onto.

Can anyone suggest another route to accomplish this?

share|improve this question

closed as too localized by toscho Feb 15 '13 at 20:14

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.