博客更新 WordPress 6.0 了吗?如果已经更新,编辑器自定义按钮有可能失效。如果没有使用 admin_print_footer_scripts 钩子,编辑器自定义按钮不会出问题。
「平价稳定机场推荐:自由鲸¥10/42G/月心阶云邀请码最新优惠码2023」
WordPress 6.0 编辑器自定义按钮失效如何解决?
WordPress 6.0 编辑器自定义按钮失效主要跟 admin_print_footer_scripts 钩子有关。尝试把 admin_print_footer_scripts 钩子换成 after_wp_tiny_mce 即可。
世外桃源 0xo.net|uxtt.com|867755.com...「WordPress 6.0 编辑器添加自定义按钮代码更新:https://sars.win/19」WordPress 6.0 编辑器添加自定义按钮代码更新参考如下:
//添加HTML编辑器自定义快捷标签按钮
add_action('after_wp_tiny_mce', 'theme_add_button_mce');
function theme_add_button_mce($mce_settings) {
?>
<script type="text/javascript">
//edButtons[110]=null;
QTags.addButton( 'p', 'p', '<p style="text-indent: 2em;">', '</p>');
QTags.addButton( 'h2', 'h2', '<h2>', '</h2>');
QTags.addButton( 'h3', 'h3', '<h3>', '</h3>');
QTags.addButton( 'h4', 'h4', '<h4>', '</h4>');
QTags.addButton( 'h5', 'h5', '<h5>', '</h5>');
</script>
<?php
}
如无意外,如上参考代码更新一下即可恢复。
世外桃源 0xo.net|uxtt.com|867755.com...「WordPress 6.0 编辑器添加自定义按钮代码更新:https://sars.win/19」「平价稳定机场推荐:自由鲸¥10/42G/月心阶云邀请码最新优惠码2023」
Comments:0