Skip to content

Commit 836757c

Browse files
committed
Only add longdesc block style if a UI is enabled.
1 parent 34fb15c commit 836757c

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/wp-accessibility-longdesc.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,19 @@ function wpa_longdesc_add_attr( $html, $id, $caption, $title, $align, $url, $siz
173173
*/
174174
function wpa_register_block_style() {
175175
if ( function_exists( 'register_block_style' ) ) {
176-
/**
177-
* Core function. Add reference style for long description.
178-
*/
179-
register_block_style(
180-
'core/image',
181-
array(
182-
'name' => 'longdesc',
183-
'label' => __( 'Has Long Description', 'wp-accessibility' ),
184-
'style_handle' => 'longdesc-style',
185-
)
186-
);
176+
if ( 'false' !== get_option( 'wpa_longdesc' ) ) {
177+
/**
178+
* Core function. Add reference style for long description.
179+
*/
180+
register_block_style(
181+
'core/image',
182+
array(
183+
'name' => 'longdesc',
184+
'label' => __( 'Has Long Description', 'wp-accessibility' ),
185+
'style_handle' => 'longdesc-style',
186+
)
187+
);
188+
}
187189
}
188190
}
189191
add_action( 'init', 'wpa_register_block_style' );

0 commit comments

Comments
 (0)