WordPress: Change the URL slug of the attachment page

As many of you know, WordPress has the attachment page to show each and every attachment added to a post. Upon clicking an image in a post, it takes you to the attachment page of that image. Now the problem for me lies in the slug WordPress chooses for this page. It takes the filename of the image as its slug. So if your image has the filename 'IMG0019.jpg', the url to the page becomes http://yoursite.com/post/img0019/

This makes little sense to me. I want the slug to be the caption of the image and if it is not available, only then it should choose the filename of the image. How to go about this?


You can use plugin to choose the attachment post slug, e.g. http://wordpress.org/extend/plugins/slug4apig/

PS: you can post this kind of question on http://wordpress.stackexchange.com/

Need Your Help

javascript calling function as array element

javascript arrays function loops call

I came across this example in a Toptal youtube video that uses syntax that won't run in Chrome, unless I am missing something. This example comes up here (JavaScript closure inside loops – simple

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.