[wp-trac] [WordPress Trac] #56180: header_image(): may consider adding filter in 'header_image()'

WordPress Trac noreply at wordpress.org
Tue Jul 12 03:07:50 UTC 2022


#56180: header_image(): may consider adding filter in 'header_image()'
-------------------------------------------------+-------------------------
 Reporter:  hztyfoon                             |       Owner:  audrasjb
     Type:  feature request                      |      Status:  reviewing
 Priority:  normal                               |   Milestone:  6.1
Component:  Themes                               |     Version:  2.1
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests has-        |     Focuses:
  testing-info needs-testing                     |  administration
-------------------------------------------------+-------------------------
Changes (by costdev):

 * keywords:  has-patch needs-unit-tests needs-testing-info needs-testing =>
     has-patch has-unit-tests has-testing-info needs-testing


Comment:

 == Testing Instructions

 === Steps to Test
 1. Add the following code to `functions.php`:
 {{{#!php
 <?php

 add_filter( 'header_image', 'my_custom_header_image' );
 function my_custom_header_image( $header_image ) {
         return 'http://example.org/my-custom-header-image.jpg';
 }

 add_action( 'admin_notices', 'my_custom_header_image_notice' );
 function my_custom_header_image_notice() {
         echo '<div class="notice notice-info"><p>'. get_header_image() .
 '</p></div>';
 }
 }}}
 2. Navigate to the Dashboard.

 === Expected Results

 - A notice should appear containing the following: `http://example.org/my-
 custom-header-image.jpg`

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56180#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list