i want to change the address of the file attachment link to wordpress [example: http://www.sitename.com/category/sub-category/article.html/attachment/image etc.]. i did research on the subject a few days, but could not get any results..
looking at the structure of the connection! after “.html“, “/” mark does not look very nice to come. also the “attachment” as the fixing of that section, for WordPress users of different languages are missing a very large. i mean; rewrite.php file links to the author for the “author” from the base. this too, edit with the help of a simple function;
global $wp_rewrite; $wp_rewrite->author_base = 'example'; $wp_rewrite->flush_rules();
i can not for this “attachment” :/ i tried so hard but i could not deal with this problem…
anyway, i wanted to ask you!
i’m not a coder (i’m a graphic designer). i want to do, so maybe things can make the limits of logic (: image.php file as it is sufficient to open a url more sense to me …
this link; http://www.sitename.com/category/sub-category/article.html/attachment/image
whether such; http://www.sitename.com/category/sub-category/article.html?file=image
i do not know would not open the image.php file in the form of “?file=image“. so i can carry out your suggestions.
thank you in advance.
regards,
Metin METE
Actually, you can always just use a query parameter, even if you have the “pretty” permalinks enabled. So instead of
/category/sub-category/article.html/attachment/image
you can go to/?attachment=image
. The only case when this “breaks down” is when you go to/category/sub-category/article.html?attachment=image
, because WordPress gets confused: it tries to query for a post and an attachment at the same time. However, this is very simple to handle: check for the request, and if it is an attachment remove the other parameters.Now you only have to change the generated attachment URLs. Since they are almost in the correct format, we can just so some search and replace: