Title: Custom prefix options?
Last modified: August 21, 2016

---

# Custom prefix options?

 *  Resolved [Alex](https://wordpress.org/support/users/alexiarna/)
 * (@alexiarna)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/custom-prefix-options/)
 * Hi there and thank you for your great work,
 * What are the possible options for the custom prefix box? Can it take any loop
   variables or just plain text?
 * Regards,
    Alex.
 * [http://wordpress.org/extend/plugins/uploadplus/](http://wordpress.org/extend/plugins/uploadplus/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Paolo T. (pixline)](https://wordpress.org/support/users/pixline/)
 * (@pixline)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/custom-prefix-options/#post-3822327)
 * Hi Alex, custom prefix are actually static only ( = plain text) for both security
   and performance reasons.
 * The issue is that this plugin acts on a very low level on files uploading, so
   loop variables and the like won’t probably be available at the time our plugin
   is triggered in about 9 out of 10 runs. We too couldn’t recognize a lot of use
   cases and we’re learning about them almost daily! 🙂
 * That said, we’re considering a couple of enhancements on custom prefixes and 
   I’d like to know more about your use case: maybe it’s something we can achieve
   in a different way.
 * Thank you for caring!
    p.
 *  Thread Starter [Alex](https://wordpress.org/support/users/alexiarna/)
 * (@alexiarna)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/custom-prefix-options/#post-3822328)
 * Thanks Paolo, no problem, in my case I’d like to have the file renamed using 
   the post title,
 * In the mean time I managed to rename the file using the post title by adding 
   the following code to the core.class.php and admin.class.php files.
 * In core.class.php, on line 100:
 * case “C”: $file_name = str_replace( array(“.”,”_”,”-“,” “) ,$sep, sanitize_title(
   get_the_title() ) ).$sep.$file_name; break;
 * In admin.class.php, line 85:
 * “C” => ‘Post title and the filename’
 * So far it works really well by adding the post name before the filename which
   is pretty much what I need. I did not looked into the “demo string” feature and
   I realise that I have to use an IF somewhere to intercept situations where the
   post does not have a name defined.
 * But so far so good, I’m happy with this. That’s why open source rocks. And that’s
   why I thank you again 😉
 *  Plugin Author [Paolo T. (pixline)](https://wordpress.org/support/users/pixline/)
 * (@pixline)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/custom-prefix-options/#post-3822335)
 * The issue with this approach – as you already know – is that it won’t work with
   media uploads from outside a post/page (i.e. direct upload in the media library):
   they can’t have that context if no new post/page is hosting this uploaded file.
 * We need to think a bit more about it, find out something a bit more comprehensive
   for the average user out there. But that’s open source: if you’re fine with that
   solution go for it! 🙂
 *  Thread Starter [Alex](https://wordpress.org/support/users/alexiarna/)
 * (@alexiarna)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/custom-prefix-options/#post-3822347)
 * You are right, I just filtered out the Media section on the Admin menu 😀
    Thanks
   again A LOT! I’ll keep an eye on your plugin as it really helped me.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Custom prefix options?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/uploadplus.svg)
 * [UploadPlus : File Name Cleaner](https://wordpress.org/plugins/uploadplus/)
 * [Support Threads](https://wordpress.org/support/plugin/uploadplus/)
 * [Active Topics](https://wordpress.org/support/plugin/uploadplus/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/uploadplus/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/uploadplus/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Alex](https://wordpress.org/support/users/alexiarna/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/custom-prefix-options/#post-3822347)
 * Status: resolved