[wp-trac] [WordPress Trac] #53729: $title never used, Replaced with text

WordPress Trac noreply at wordpress.org
Wed Jul 21 22:22:57 UTC 2021


#53729: $title never used, Replaced with text
-------------------------------------------------+-------------------------
 Reporter:  ravipatel                            |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Help/About                           |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-refresh close 2nd-   |     Focuses:  coding-
  opinion                                        |  standards
-------------------------------------------------+-------------------------
Changes (by SergeyBiryukov):

 * keywords:  has-patch needs-refresh => has-patch needs-refresh close 2nd-
     opinion


Comment:

 Hi there, thanks for the patch!

 It might not be immediately clear, but the `$title` variable is used in
 `wp-admin/admin-header.php`.

 This is a common pattern used in many admin files, not just in `wp-
 admin/privacy.php`:
 {{{
 $title = __( 'Privacy' );
 ...
 require_once ABSPATH . 'wp-admin/admin-header.php';
 }}}


 Looking at the About page and related pages:

 * `wp-admin/about.php`:
 {{{
 $title = _x( 'About', 'page title' );
 ...
 require_once ABSPATH . 'wp-admin/admin-header.php';
 ...
 <div class="about__header-title">
         <h1>
                 <?php _e( 'WordPress' ); ?>
                 <?php echo $display_version; ?>
         </h1>
 </div>
 }}}
 * `wp-admin/credits.php`:
 {{{
 $title = __( 'Credits' );
 ...
 require_once ABSPATH . 'wp-admin/admin-header.php';
 ...
 <div class="about__header-title">
         <h1>
                 <?php _e( 'Contributors' ); ?>
         </h1>
 </div>
 }}}
 * `wp-admin/freedoms.php`:
 {{{
 $title = __( 'Freedoms' );
 ...
 require_once ABSPATH . 'wp-admin/admin-header.php';
 ...
 <div class="about__header-title">
         <h1>
                 <?php _e( 'The Four Freedoms' ); ?>
         </h1>
 </div>
 }}}
 * `wp-admin/privacy.php`:
 {{{
 $title = __( 'Privacy' );
 ...
 require_once ABSPATH . 'wp-admin/admin-header.php';
 ...
 <div class="about__header-title">
         <h1>
                 <?php _e( 'Privacy' ); ?>
         </h1>
 </div>
 }}}

 So the Privacy page is the only one where `$title` is the same as the
 `<h1>` tag. We could technically reuse the `$title` variable for the
 `<h1>` tag here, but that would make it a bit inconsistent with the other
 pages.

 The existing code seems good to me as is.

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


More information about the wp-trac mailing list