WordPress not allowing FILE links.

To allow you to use FILE:// Links in a wordpress menu you need to add the protocol to the wp_allowed_protocols function in wp_includes/functions.php

function wp_allowed_protocols() {
        static $protocols = array();

        if ( empty( $protocols ) ) {
                $protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp', 'webcal', 'file'  );

                /**
                 * Filters the list of protocols allowed in HTML attributes.
                 *
                 * @since 3.0.0
                 *
                 * @param array $protocols Array of allowed protocols e.g. 'http', 'ftp', 'tel', and more.
                 */
                $protocols = apply_filters( 'kses_allowed_protocols', $protocols );
        }

        return $protocols;
}

About Jeff Turner

Technical director of Nano Tera Network Solutions.
This entry was posted in Hints and Tips, Powershell, VBS, VBA and other scripting.. Bookmark the permalink.