Skip to content

Instantly share code, notes, and snippets.

View vitaliikaplia's full-sized avatar
🇺🇦

Vitalii Kaplia vitaliikaplia

🇺🇦
View GitHub Profile
@vitaliikaplia
vitaliikaplia / media-rename.php
Last active April 21, 2022 19:31
Rename file on upload inside post
function wpsx_5505_modify_uploaded_file_names($arr) {
// Get the parent post ID, if there is one
if( isset($_REQUEST['post_id']) ) {
$post_id = $_REQUEST['post_id'];
} else {
$post_id = false;
}
// Only do this if we got the post ID--otherwise they're probably in