Skip to content

Commit dbee431

Browse files
committed
Example of how to remove the toolbar
Example removes on one single page with slug 'sign-in'
1 parent 2b0baac commit dbee431

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

wp-accessibility/remove-toolbar.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
/*
3+
Plugin Name: Remove toolbar on a page
4+
Plugin URI: http://www.joedolson.com
5+
Description: Disable the accessibility toolbar on a specific post or page
6+
Author: Joe Dolson
7+
Version: 1.0.0
8+
Author URI: http://www.joedolson.com/
9+
*/
10+
11+
add_action( 'init', 'my_deregister_scripts' );
12+
function my_deregister_scripts() {
13+
if ( is_page( 'sign-in' ) ) {
14+
wp_dequeue_script( 'ui-a11y.js' );
15+
}
16+
}
17+
18+
add_action( 'wp_enqueue_scripts', 'my_remove_toolbar', 1000 );
19+
function my_remove_toolbar() {
20+
if ( is_page( 'sign-in' ) ) {
21+
remove_action( 'wp_footer', 'wpa_toolbar_js' );
22+
}
23+
}

0 commit comments

Comments
 (0)