Plugin Contributor
nwjames
(@nwjames)
@torralaq,
You have two requirements to change the permalink:
- Remove the year/month element. This is available with the plugin. It’s the last option in the
Settings -> Media -> Uploading Files and is called Document Date in Permalink. Tick it to remove the date element. Note that this is independent of whether the file is stored in a year/month folder.
- Remove the extension. You will require some trivial code to do this. Use the filter
document_permalink to remove it (and the period) from the generated permalink.
Note that the delivered rewrite rules support your required format. That is, take a currently valid permalink and remove the date and extension elements and you can use that link to retrieve your document even now.
Hope this is of use,
Neil James
On the year/month: This setting is not in that location on a network (multisite) wordpress, and I’ve scanned the 500 or so settings for the site in the network admin, but I do not see anything that seems like it could be it. I’m sure I just don’t have the name right. I see however that there is a plugin for seeing network settings when the plugin is not network enabled. So, I tried that but the plugin crashes the server (Plugin could not be activated because it triggered a fatal error.)
I just used document_permalink to modify both, thank you!
Plugin Contributor
nwjames
(@nwjames)
@torralaq,
I do apologise for misleading you on the year/month settings. When I implemented that a while ago, it seems that I did not implement it for the multisite case (that I don’t use).
Different code is required for the multisite case. I will propose the necessary change.
Meanwhile, as you have done, this can be addressed in the filter.
Thank you for raising this and giving the feedback.
Neil James
Originally I thought it worked, but now it’s acting very funky. I know on the main site it worked, then I tried on a subsite and it did not (404). I’ve been messing around with different things and what finally worked on the subsite was to only enable the plugin on the site (not network activated). However, going back to the main site, it no longer works there and insists on still using the full url with dates and extension despite the filter. So I suspect some general multisite funkiness all around π
My main site is not used for anything other than a home for the subs, so I don’t really need it to work there…..so for me, it seems things might be working now. But I figured you may want to know and see if there is anything that would make it all work better on multisite π
OH! One other thing, not sure if this is how the plugin is supposed to work or if it’s another possible issue on multisite, but when you upload a file, it does not give any indication that you’ve done that. It’s only after you click publish or update that you see the file listed there. Thanks π