在最近的一次WordPress udpate (我在4.9.9)之后,似乎出现了这个问题,因为我以前从未遇到过问题。
我使用以下代码在前端加载wp_editor:
$argswp = array(
'textarea_rows' => 10,
'teeny' => false,
'quicktags' => false,
'wpautop' => true,
'media_buttons' => false,
'tinymce' => array(
'theme_advanced_buttons1' => 'custom1',
),
);
wp_editor( 'Write your content here...', 'postContent', $argswp ); ?> 我现在遇到的问题是,当regular非admin用户登录并看到这个编辑器时,有些按钮不显示,另一些则不工作。例如,选择insert/edit链接会导致页面向下滚动,但什么也不会发生,通常出现的“弹出”框无法工作。

在遍历了所有网络请求(一次作为管理员,一次作为常规用户)之后,我可以看到常规用户没有得到以下.css文件:
/wp-includes/css/editor.min.css?ver=4.9.9所以我尝试了两件事,我首先尝试在我的php函数文件中注册并排队,然后我尝试将它作为外部样式表链接直接添加到页面的html中。这是这两种情况的结果:

该按钮现在工作,但他们似乎没有正确的加载现在。我们很感激你的帮助!
发布于 2019-02-26 09:22:41
修好了!尽管我仍然不知道为什么现在必须在以前没有的情况下为特定的样式表排队。如果有人知道为什么我会很感激的。
但现在,我的回答是:
我之前在这段代码中添加过,这是个坏主意。出于某种原因,我没有使用这些特定的图标:
// remove dashicons as they don't need to be loaded on the front-end and are using 1400ms in render blocking
function wpdocs_dequeue_dashicon() {
if (current_user_can( 'edit_published_posts' )) {
return;
}
wp_deregister_style('dashicons');
}
add_action( 'wp_enqueue_scripts', 'wpdocs_dequeue_dashicon' ); 移除这个图标问题。
然后我不得不注册并登记样式:
wp_register_style( 'tinymce_stylesheet', 'https://example.org/wp-includes/css/editor.min.css?ver=4.9.9' );
//Editor Stylesheet for Deck Submit
function editor_send_deck() {
// only enqueue on specific page slug
if ( is_page( 'front-end' ) ) {
wp_enqueue_style( 'tinymce_stylesheet' );
}
}
add_action( 'wp_enqueue_scripts', 'editor_send_deck' );https://wordpress.stackexchange.com/questions/329974
复制相似问题