Make WordPress Core


Ignore:
Timestamp:
07/20/2022 09:11:30 PM (4 years ago)
Author:
audrasjb
Message:

Themes: Add a hook to filter theme header image URL.

This changeset introduces the get_header_image filter, which can be used to modify header image URL returned by get_header_image(), in themes that support the Header Image feature.

Props hztyfoon, audrasjb, mukesh27, SergeyBiryukov, costdev.
Fixes #56180.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/theme.php

    r53704 r53741  
    11801180        }
    11811181
     1182        /**
     1183         * Filters the header image URL.
     1184         *
     1185         * @since 6.1.0
     1186         *
     1187         * @param string $url Header image URL.
     1188         */
     1189        $url = apply_filters( 'get_header_image', $url );
     1190
     1191        if ( ! is_string( $url ) ) {
     1192                return false;
     1193        }
     1194
     1195        $url = trim( $url );
    11821196        return sanitize_url( set_url_scheme( $url ) );
    11831197}
Note: See TracChangeset for help on using the changeset viewer.