[wp-trac] [WordPress Trac] #60782: The method parameter is never used.

WordPress Trac noreply at wordpress.org
Thu Jun 20 03:15:10 UTC 2024


#60782: The method parameter is never used.
-------------------------+------------------------------
 Reporter:  patelmohip   |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------

Comment (by jhonemuze):

 Hello,

 I have noticed that the `update_home_siteurl()` function in WordPress has
 two parameters (`$old_value` and `$value`) that are never used within the
 function block. This function is defined in `wp-admin/includes/misc.php`
 at line 558:

 {{{#!php
 <?php
 /**
  * Flushes rewrite rules if siteurl, home, or page_on_front changed.
  *
  * @since 2.1.0
  *
  * @param string $old_value
  * @param string $value
  */
 function update_home_siteurl( $old_value, $value ) {
         if ( wp_installing() ) {
                 return;
         }

         if ( is_multisite() && ms_is_switched() ) {
                 delete_option( 'rewrite_rules' );
         } else {
                 flush_rewrite_rules();
         }
 }
 }}}


 Additionally, the action hooks for this function are defined in `wp-
 admin/includes/admin-filters.php` at lines 71-73:



 {{{#!php
 <?php
 add_action( 'update_option_home', 'update_home_siteurl', 10, 2 );
 add_action( 'update_option_siteurl', 'update_home_siteurl', 10, 2 );
 add_action( 'update_option_page_on_front', 'update_home_siteurl', 10, 2 );

 }}}



 These hooks pass two parameters to the `update_home_siteurl()` function,
 but the parameters are not utilized within the function.

 Could anyone provide insights on whether these parameters are intended for
 future use, or if they can be safely removed to clean up the code? Any
 guidance on this matter would be greatly appreciated.

 Thank you!

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


More information about the wp-trac mailing list