[wp-trac] [WordPress Trac] #51712: editPermalink() does not properly restore buttons after editing.

WordPress Trac noreply at wordpress.org
Fri Nov 27 18:44:40 UTC 2020


#51712: editPermalink() does not properly restore buttons after editing.
-----------------------------------+------------------------------
 Reporter:  bjornbrandewallnaviga  |       Owner:  (none)
     Type:  defect (bug)           |      Status:  new
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  Editor                 |     Version:  5.5.1
 Severity:  minor                  |  Resolution:
 Keywords:                         |     Focuses:  javascript
-----------------------------------+------------------------------

Comment (by sabernhardt):

 @bjornbrandewallnaviga Thanks for the report!

 I think you might have better success using the
 `get_sample_permalink_html` filter rather than inserting buttons with
 JavaScript.

 Adding a button at the end of the `edit-slug-box` container:

 {{{
 add_filter( 'get_sample_permalink_html',
 'my_permalink_button_added_to_end', 10, 1 );

 function my_permalink_button_added_to_end( $html )
 {
         $newbutton = '<button type="button" class="button button-
 small">This button also ought to perservere!</button>';

         $html .= $newbutton;

         return $html;
 }
 }}}

 Adding a button inside the `edit-slug-buttons` container:

 {{{
 add_filter( 'get_sample_permalink_html',
 'my_permalink_button_added_inside', 10, 1 );

 function my_permalink_button_added_inside( $html )
 {
         $newbutton = '<button type="button" class="button button-
 small">This button ought to perservere!</button>';

         $output = str_replace(
                 "</button></span>",
                 "</button> " . $newbutton . "</span>",
                 $html
         );

         return $output;
 }
 }}}

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


More information about the wp-trac mailing list