Adjust Permalink Structure For Attachments
-
Hi there. I want to be able to rewrite (if possible) the base name for an attachement page for a post.
Here is an example:-
https://www.domain.com/photos/36/summer-vactation/attachment/beach-03/
https://www.domain.com/photos/36/summer-vactation/gallery/beach-03/
I want to change the attachment part to another word, rather than having the default way with “attachment”
I’ve tried looking through the rewrite.php file but it does not make sense.
I have managed to change the link structure in the link-template.php file to:-
if ( is_numeric($object->post_name) || false !== strpos(get_option(‘permalink_structure’), ‘%category%’) )
$name = ‘gallery/’ . $object->post_name; // <permalink>/<int>/ is paged so we use the explicit attachment markerThis doesn’t work when the link is launched, it just 404s. Do I need to edit the htaccess file for it to over ride this?
I am not much of a programmer, so your help would be appreciated.
Thanks in advance.
- The topic ‘Adjust Permalink Structure For Attachments’ is closed to new replies.