WordPress.org

Make WordPress Core

Ticket #18302: 18302.theme_url.7.diff

File 18302.theme_url.7.diff, 1.2 KB (added by georgestephanis, 6 years ago)

Adding in caveat for not passing argument

  • wp-includes/link-template.php

     
    20612061}
    20622062
    20632063/**
     2064 * Retrieve the url of the template file.
     2065 *
     2066 * Searches in the stylesheet directory before the template directory so themes
     2067 * which inherit from a parent theme can just overload one file.
     2068 *
     2069 * @since 3.5
     2070 *
     2071 * @param string $template_names Template file to search for.
     2072 * @return string The URI of the file if one is located.
     2073 */
     2074function theme_url( $file = '' ) {
     2075        $file = ltrim( $file, '/' );
     2076
     2077        if ( empty( $file ) || ( false !== strpos( $file, '..' ) ) ) {
     2078                $url = get_stylesheet_directory_uri();
     2079        } elseif ( is_child_theme() && file_exists( trailingslashit( get_stylesheet_directory() ) . $file ) ) {
     2080                $url = trailingslashit( get_stylesheet_directory_uri() ) . $file;
     2081        } else {
     2082                $url = trailingslashit( get_template_directory_uri() ) . $file;
     2083        }
     2084
     2085        return apply_filters( 'theme_url', $url, $file );
     2086}
     2087
     2088/**
    20642089 * Retrieve the site url for the current network.
    20652090 *
    20662091 * Returns the site url with the appropriate protocol, 'https' if