Skip to content

Instantly share code, notes, and snippets.

@psorensen
Created November 14, 2014 00:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psorensen/ee79f92344deaeeccee6 to your computer and use it in GitHub Desktop.
Save psorensen/ee79f92344deaeeccee6 to your computer and use it in GitHub Desktop.
add_action('pmxi_attachment_uploaded', 'my_attachment_uploaded', 10, 3);
function my_attachment_uploaded($pid, $attid, $filepath){
$attachment = get_post($attid);
// do something with $attachment file
if (get_post($pid) == 'industry-resource') {
wp_update_post(array('ID' => $attid, 'guid' => str_replace('uploads/', 'uploads/indres/', $filepath)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment