When a file with the .xml
extension has been uploaded on my blog (via the Add Media uploader) I would like to automatically replace some attributes.
For example, if I upload a file with this content:
<content creator="foo"></content>
I would like that WordPress modifies it automatically in:
<content creator="bar"></content>
What hook should I use and how?
You can do this using the
wp_handle_upload
hook:http://adambrown.info/p/wp_hooks/hook/wp_handle_upload?version=3.4&file=wp-admin/includes/file.php
Create a function and add it to this hook so it runs last, it will be passed an array. The array contains the location of the newly uploaded file:
Modifying the XML file etc, is another task that is not within the scope of this site.