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

WordPress Trac noreply at wordpress.org
Thu Mar 12 23:40:06 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 sabernhardt):

 I have no //expectation// that sites would require the parameter, so I did
 not like the idea of adding a parameter to the theme's function just for
 code quality.

 However, PR 11242 did not affect the output for any of these edit links:
  - front page (Home)
  - the four pages added to the front page section content panels
  - single page (About)
  - page of posts (Blog)
  - single post (Today's post)
  - category archive (Uncategorized)

 PR 11242 did not alter the function output when I added these filters
 either (in a custom must-use plugin):

 {{{
 /**
  * Appends the post type and ID after the post edit link anchor tag.
  *
  * @param string $link    Anchor tag for the edit link.
  * @param int    $post_id Post ID.
  */
 function edit_post_link_add_post_type_and_id( $link, $post_id = 0 ) {
         $post_type = get_post_type( $post_id );
         if ( $post_type ) {
                 $link .= ' ' . $post_type . '-' . $post_id;
         }

         return $link;
 }
 add_filter( 'edit_post_link', 'edit_post_link_add_post_type_and_id', 10, 2
 );

 /**
  * Appends the post type and ID after the post title.
  *
  * @param string $post_title The post title.
  * @param int    $post_id    The post ID.
  */
 function the_title_add_post_type_and_id( $post_title, $post_id = 0 ) {
         $post_type = get_post_type( $post_id );
         if ( $post_type ) {
                 $post_title .= ' ' . $post_type . '-' . $post_id;
         }

         return $post_title;
 }
 add_filter( 'the_title', 'the_title_add_post_type_and_id', 10, 2 );
 }}}

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


More information about the wp-trac mailing list