[wp-trac] [WordPress Trac] #64825: Twenty Seventeen: twentyseventeen_edit_link() function passed

WordPress Trac noreply at wordpress.org
Tue Mar 10 00:09:53 UTC 2026


#64825: Twenty Seventeen: twentyseventeen_edit_link() function passed
---------------------------+--------------------------
 Reporter:  westonruter    |       Owner:  westonruter
     Type:  defect (bug)   |      Status:  assigned
 Priority:  normal         |   Milestone:  7.0
Component:  Bundled Theme  |     Version:  4.7
 Severity:  minor          |  Resolution:
 Keywords:  has-patch      |     Focuses:
---------------------------+--------------------------

Comment (by westonruter):

 To me, then, it seems we should actually go ahead and document the
 parameter and actually use it:

 {{{#!diff
 --- a/src/wp-content/themes/twentyseventeen/inc/template-tags.php
 +++ b/src/wp-content/themes/twentyseventeen/inc/template-tags.php
 @@ -116,16 +116,19 @@ if ( ! function_exists( 'twentyseventeen_edit_link'
 ) ) :
          * (post or page?) so that users understand a bit more where they
 are in terms
          * of the template hierarchy and their content. Helpful when/if
 the single-page
          * layout with multiple posts/pages shown gets confusing.
 +        *
 +        * @param int $post_id Post ID. Default 0.
          */
 -       function twentyseventeen_edit_link() {
 +       function twentyseventeen_edit_link( $post = 0 ) {
                 edit_post_link(
                         sprintf(
                                 /* translators: %s: Post title. Only
 visible to screen readers. */
                                 __( 'Edit<span class="screen-reader-text">
 "%s"</span>', 'twentyseventeen' ),
 -                               get_the_title()
 +                               get_the_title( $post )
                         ),
                         '<span class="edit-link">',
 -                       '</span>'
 +                       '</span>',
 +                       $post
                 );
         }
  endif;
 }}}

 The `get_the_title()` and `edit_post_link()` functions take a `$post`
 param that defaults to `0` anyway, the end result would be identical.

 Note: There do not appear to be any child themes on the directory that
 override this pluggable function: <https://veloria.dev/search/ec609afc-
 8b60-4ea2-8333-6c58d559c618>. Although there could be outside the
 directory.

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


More information about the wp-trac mailing list