Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

Commit

Permalink
Prepend anchor IDs with a string to prevent them from starting with a…
Browse files Browse the repository at this point in the history
… number
  • Loading branch information
dotherightthing committed Dec 30, 2020
1 parent 771b033 commit 058da3f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/class-wpdtrt-anchorlinks-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function render_headings_as_anchors( string $content ) : string {

// class is also used by $this->render_headings_in_sections().
$heading->setAttribute( 'class', 'wpdtrt-anchorlinks__anchor' );
$heading_id = sanitize_title( $heading->nodeValue ); // phpcs:ignore
$heading_id = 'section-' . sanitize_title( $heading->nodeValue ); // phpcs:ignore
$heading->setAttribute( 'id', $heading_id );
$heading->setAttribute( 'tabindex', '-1' );

Expand Down

0 comments on commit 058da3f

Please sign in to comment.