diff --git a/src/js/_enqueues/admin/common.js b/src/js/_enqueues/admin/common.js index 5e15893d1f..8ea548e642 100644 --- a/src/js/_enqueues/admin/common.js +++ b/src/js/_enqueues/admin/common.js @@ -751,9 +751,15 @@ $availableStructureTags.on( 'click', function() { selectionStart = $permalinkStructure[ 0 ].selectionStart, selectionEnd = $permalinkStructure[ 0 ].selectionEnd, textToAppend = $( this ).text().trim(), - textToAnnounce = $( this ).attr( 'data-added' ), + textToAnnounce, newSelectionStart; + if ( $( this ).hasClass( 'active' ) ) { + textToAnnounce = $( this ).attr( 'data-removed' ); + } else { + textToAnnounce = $( this ).attr( 'data-added' ); + } + // Remove structure tag if already part of the structure. if ( -1 !== permalinkStructureValue.indexOf( textToAppend ) ) { permalinkStructureValue = permalinkStructureValue.replace( textToAppend + '/', '' ); diff --git a/src/wp-admin/options-permalink.php b/src/wp-admin/options-permalink.php index 2d91d9fffe..63749233ff 100644 --- a/src/wp-admin/options-permalink.php +++ b/src/wp-admin/options-permalink.php @@ -309,7 +309,8 @@ $available_tags = apply_filters( 'available_permalink_structure_tags', $availabl /* translators: %s: Permalink structure tag. */ $tag_added = __( '%s added to permalink structure' ); - +/* translators: %s: Permalink structure tag. */ +$tag_removed = __( '%s removed from permalink structure' ); /* translators: %s: Permalink structure tag. */ $tag_already_used = __( '%s (already used in permalink structure)' ); ?> @@ -378,6 +379,7 @@ printf( class="button button-secondary" aria-label="" data-added="" + data-removed="" data-used="">