This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* | |
* Genrate Slugs from Title or any given string | |
* | |
* @param string $str | |
* @return Slug | |
* | |
**/ |