Quicktags: Cannot make a span class
Question
I am trying to adding custom quicktags like this:
function wporg_add_quicktag_paragraph() {
wp_add_inline_script(
'quicktags',
"QTags.addButton( 'title_tag', 'title', '<span class="title">', '</span>', '', '', 1);"
);
}
add_action( 'admin_enqueue_scripts', 'wporg_add_quicktag_paragraph' );
Using <span class="title">
throws an error. But if I change <span class="title">
to <span>
, it works fine.
I was able to add <span class="title">
as a quicktag until the WordPress 6.0 update. My new code is based of this: https://developer.wordpress.org/apis/quicktags/
For reference, my pre 6.0 code was as below. Obviously it doesn’t work now.
function add_quicktags() {
if ( wp_script_is( 'quicktags' ) ) { ?>
<script type="text/javascript">
QTags.addButton( 'title_tag', 'title', '<span class="title">', '</span>', '', '', 1 );
</script>
<?php }
}
add_action( 'admin_print_footer_scripts', 'add_quicktags' );
Thanks in advance
0
4 weeks
2023-03-01T20:24:22-05:00
2023-03-01T20:24:22-05:00 0 Answers
0 views
0
Leave an answer