WordPress: Secret, Undocumented, Hard to Find & Very Useful Hooks
an ongoing list…feel free to contribute!
Media Library
pre-upload-ui | post-upload-ui | pre-html-upload-ui | post-html-upload-ui | pre-flash-upload-ui | post-flash-upload-ui
(media.php: ~1488)
Parameters: None
Inserts html into the media library uploader form. The html and flash work for their versions only and the general two work for both.
Media Uploading
wp_handle_upload
Occurs when file is first uploaded. No DB data available yet.
wp_update_attachment_metadata / add_attachment
Occurs after upload and initial inserts into the wp_post and wp_postmeta (_wp_attached_file key) tables. Sizes have been calculated but their meta (a separate key) has yet to be entered into the DB. Attempting to get any thumbnail sizes will give you the source image.
added_post_meta:
Params: $meta_id, $attachment_id, $meta_key, $meta_value
Referencing code: do_action( "add_{$meta_type}_meta", $object_id, $meta_key, $_meta_value );
Source file: /wp -includes/meta.php
Safe to use wp_get_attachment_image($id, $size) and image_downsize(...) to get the appropriate thumbs.


