diff --git src/wp-admin/includes/deprecated.php src/wp-admin/includes/deprecated.php
index b032018f28..a95214975b 100644
|
|
function post_form_autocomplete_off() { |
1490 | 1490 | echo ' autocomplete="off"'; |
1491 | 1491 | } |
1492 | 1492 | } |
| 1493 | |
| 1494 | /** |
| 1495 | * Display JavaScript on the page. |
| 1496 | * |
| 1497 | * @since 3.5.0 |
| 1498 | * @deprecated 4.9.0 |
| 1499 | */ |
| 1500 | function options_permalink_add_js() { |
| 1501 | ?> |
| 1502 | <script type="text/javascript"> |
| 1503 | jQuery(document).ready(function() { |
| 1504 | jQuery('.permalink-structure input:radio').change(function() { |
| 1505 | if ( 'custom' == this.value ) |
| 1506 | return; |
| 1507 | jQuery('#permalink_structure').val( this.value ); |
| 1508 | }); |
| 1509 | jQuery( '#permalink_structure' ).on( 'click input', function() { |
| 1510 | jQuery( '#custom_selection' ).prop( 'checked', true ); |
| 1511 | }); |
| 1512 | }); |
| 1513 | </script> |
| 1514 | <?php |
| 1515 | } |
diff --git src/wp-admin/includes/options.php src/wp-admin/includes/options.php
index 6b8114d571..053d5eec64 100644
|
|
function options_general_add_js() { |
91 | 91 | * |
92 | 92 | * @since 3.5.0 |
93 | 93 | */ |
94 | | function options_permalink_add_js() { |
95 | | ?> |
96 | | <script type="text/javascript"> |
97 | | jQuery(document).ready(function() { |
98 | | jQuery('.permalink-structure input:radio').change(function() { |
99 | | if ( 'custom' == this.value ) |
100 | | return; |
101 | | jQuery('#permalink_structure').val( this.value ); |
102 | | }); |
103 | | jQuery( '#permalink_structure' ).on( 'click input', function() { |
104 | | jQuery( '#custom_selection' ).prop( 'checked', true ); |
105 | | }); |
106 | | }); |
107 | | </script> |
108 | | <?php |
109 | | } |
110 | | |
111 | | /** |
112 | | * Display JavaScript on the page. |
113 | | * |
114 | | * @since 3.5.0 |
115 | | */ |
116 | 94 | function options_reading_add_js() { |
117 | 95 | ?> |
118 | 96 | <script type="text/javascript"> |
diff --git src/wp-admin/js/common.js src/wp-admin/js/common.js
index 87a478a13f..94344d5602 100644
|
|
$('.contextual-help-tabs').delegate('a', 'click', function(e) { |
181 | 181 | |
182 | 182 | var permalinkStructureFocused = false, |
183 | 183 | $permalinkStructure = $( '#permalink_structure' ), |
| 184 | $permalinkStructureInputs = $( '.permalink-structure input:radio' ), |
| 185 | $permalinkCustomSelection = $( '#custom_selection' ), |
184 | 186 | $availableStructureTags = $( '.form-table.permalink-structure .available-structure-tags button' ); |
185 | 187 | |
| 188 | // Change permalink structure input when selecting one of the common structures. |
| 189 | $permalinkStructureInputs.on( 'change', function() { |
| 190 | if ( 'custom' === this.value ) { |
| 191 | return; |
| 192 | } |
| 193 | |
| 194 | $permalinkStructure.val( this.value ); |
| 195 | |
| 196 | // Update button states after selection. |
| 197 | $availableStructureTags.each( function() { |
| 198 | changeStructureTagButtonState( $( this ) ); |
| 199 | } ); |
| 200 | } ); |
| 201 | |
| 202 | $permalinkStructure.on( 'click input', function() { |
| 203 | $permalinkCustomSelection.prop( 'checked', true ); |
| 204 | } ); |
| 205 | |
186 | 206 | // Check if the permalink structure input field has had focus at least once. |
187 | 207 | $permalinkStructure.on( 'focus', function( event ) { |
188 | 208 | permalinkStructureFocused = true; |
… |
… |
$availableStructureTags.on( 'click', function() { |
249 | 269 | selectionStart = selectionEnd = permalinkStructureValue.length; |
250 | 270 | } |
251 | 271 | |
252 | | $( '#custom_selection' ).prop( 'checked', true ); |
| 272 | $permalinkCustomSelection.prop( 'checked', true ); |
253 | 273 | |
254 | 274 | // Prepend and append slashes if necessary. |
255 | 275 | if ( '/' !== permalinkStructureValue.substr( 0, selectionStart ).substr( -1 ) ) { |
diff --git src/wp-admin/options-permalink.php src/wp-admin/options-permalink.php
index c7193f96a6..c97c639546 100644
|
|
get_current_screen()->set_help_sidebar( |
46 | 46 | '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>' |
47 | 47 | ); |
48 | 48 | |
49 | | add_filter('admin_head', 'options_permalink_add_js'); |
50 | | |
51 | 49 | $home_path = get_home_path(); |
52 | 50 | $iis7_permalinks = iis7_supports_permalinks(); |
53 | 51 | $permalink_structure = get_option( 'permalink_structure' ); |