In my WordPress 3.1 admin panel, under appearance there's a Menus option.
For the URL input, I need to type file://network path/path1/path2/index.htm, but when I hit save, the value disappears. If I put http://network path/path1/path2/index.htm it works. It's like it doesn't accept FILE protocol, but only HTTP protocol. How can I find the actual PHP file so I can hard code it with the link? Or there's some other alternative?

- 946
- 6
- 14
- 31
-
How do you expect visitors of your website to have the file on their filesystem? Send it to them? The question doesn't make sense because if you use the file protocol, these only work on your computer. – Evert Apr 13 '18 at 16:36
-
It does make sense. This website is hosted into an organization. Every user has the network share mapped. – catalin Apr 13 '18 at 16:58
2 Answers
This is an old question I know but I just came across it and the accepted answer is not the right way to add an allowed protocol into WordPress. The core WordPress files should never be modified as any modifications will just be overridden when WordPress is updated. There is a very simple way to add a protocol the correct way.
In your theme's functions.php file add the following function. If you are using a downloaded theme make sure to add this to a child theme otherwise changes made to the main theme's files will be overridden when the theme is updated.
function allowed_link_protocols_filter($protocols){
$protocols[] = 'file';
return $protocols;
}
add_filter('kses_allowed_protocols', 'allowed_link_protocols_filter');
https://developer.wordpress.org/reference/hooks/kses_allowed_protocols/

- 43
- 1
- 6
I found the solution. In the wp-includes/formatting.php there's a line:
$protocols = array ('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn');
I've just added file into the array and now it accepts the file protocol into the menu

- 946
- 6
- 14
- 31