Title: Stop PHP/JavaScript inserting the skip link
Last modified: April 5, 2022

---

# Stop PHP/JavaScript inserting the skip link

 *  Resolved [Clarus Dignus](https://wordpress.org/support/users/clarus-dignus/)
 * (@clarus-dignus)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/stop-php-javascript-inserting-the-skip-link/)
 * [the_block_template_skip_link()](https://developer.wordpress.org/reference/functions/the_block_template_skip_link/)
   in [wp-includes/block-template.php](https://github.com/WordPress/WordPress/blob/master/wp-includes/theme-templates.php)
   inserts the skip link. I want to stop the insertion.
 * In functions.php, I’ve tried the following to no avail:
 *     ```
       // Attempt 1
       remove_action( 'wp_body_open', 'gutenberg_the_skip_link' );
   
       // Attempt 2
       remove_action( 'wp_body_open', 'the_block_template_skip_link' );
   
       // Attempt 3
       add_filter( 'the_block_template_skip_link',  '__return_false' );
   
       // Attempt 4
       remove_action( 'init', 'the_block_template_skip_link' );
       ```
   
 * I understand why the skip link is important. I’m not deleting it; I’m replacing
   it because I need to wrap it in a div and change the link text to title case:
 *     ```
       add_action( 'wp_body_open', 'custom_skip_link' );
   
       function custom_skip_link() {
       	echo '
       	<div class="skip-link-container">
       		<a class="skip-link screen-reader-text" href="#content">Skip to Content</a>
       	</div>
         ';
       }
       ```
   
 * I understand I can remove the skip link using jQuery but I’d prefer to stop the
   insertion using PHP.
 * To clarify, I’d also like to stop the insertion of the corresponding CSS.

Viewing 1 replies (of 1 total)

 *  Thread Starter [Clarus Dignus](https://wordpress.org/support/users/clarus-dignus/)
 * (@clarus-dignus)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/stop-php-javascript-inserting-the-skip-link/#post-15535810)
 * This works:
 * `remove_action( 'wp_footer', 'the_block_template_skip_link' );`
 * I didn’t consider removing the action from [wp_footer()](https://developer.wordpress.org/reference/functions/wp_footer/).
   I incorrectly assumed the_block_template_skip_link() was being applied to [wp_body_open()](https://developer.wordpress.org/reference/functions/wp_body_open/)
   because of the skip-link’s position in the page.
 * I can see now that the skip-link’s position is determined in relation to the 
   site wrapper using JavaScript:
 *     ```
       // Get the site wrapper.
       // The skip-link will be injected in the beginning of it.
       sibling = document.querySelector( '.wp-site-blocks' );
   
       [...]
   
       // Inject the skip link.
       sibling.parentElement.insertBefore( skipLink, sibling );
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Stop PHP/JavaScript inserting the skip link’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 1 participant
 * Last reply from: [Clarus Dignus](https://wordpress.org/support/users/clarus-dignus/)
 * Last activity: [4 years, 2 months ago](https://wordpress.org/support/topic/stop-php-javascript-inserting-the-skip-link/#post-15535810)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
