Skip Navigation

[Resolved] Automatically rename picture uploads

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to programmatically rename image upload files based on the post title and user's name.

Solution: There's nothing built-in to handle this, but Nigel provided an example script in the link below.

Relevant Documentation: https://toolset.com/forums/topic/split-rename-uploaded-images/

This support ticket is created 5 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#1237380

I'm curious to know if it's possible the following:

When uploading pictures in the Post Form, is there a script where the uploaded pictures would be renamed after the post title or some other combination such as post title + user's first name, etc? That way it organizes the pictures with the custom post or the user. Easier to find in the future.

#1237383

Nigel provided an example of renaming uploaded images in this ticket: https://toolset.com/forums/topic/split-rename-uploaded-images/

Note that AJAX image uploads must be disabled for this to work, and you'll have to modify the function tssupp_handle_rename_upload to format the filename as needed.

#1239188

My issue is resolved now. Thank you!