Php 如何防止“添加编辑器”样式运行?

Php 如何防止“添加编辑器”样式运行?,php,wordpress,function,plugins,hook,Php,Wordpress,Function,Plugins,Hook,我想知道如何防止添加编辑器风格的$protocol.$universal\u css\u url;通过使用我自己的functions.php运行,我是说通过钩子或类似的东西 有没有办法禁用或删除此功能?比如:删除编辑器样式$protocol.$universal\u css\u url;那太好了!不幸的是,此代码不起作用 谢谢大家! 试试这个代码示例,这应该可以让您开始了 function theme_remove_editor_styles() { // Get the global

我想知道如何防止添加编辑器风格的$protocol.$universal\u css\u url;通过使用我自己的functions.php运行,我是说通过钩子或类似的东西

有没有办法禁用或删除此功能?比如:删除编辑器样式$protocol.$universal\u css\u url;那太好了!不幸的是,此代码不起作用


谢谢大家!

试试这个代码示例,这应该可以让您开始了

function theme_remove_editor_styles() {
    // Get the global var
    global $editor_styles;
    // Get the item you want to move
    $entry_to_move = $editor_styles[4];
    // Remove a specific entry
    unset($editor_styles[4]);
    // Add the entry back to the beginning of the array
    array_unshift($editor_styles, $entry_to_move);
}
add_action('pre_get_posts', 'theme_remove_editor_styles', 100);

add_editor_style将样式表添加到全局$editor_style数组变量。您可以尝试清除该阵列!?我的意思是从数组中删除不需要的样式表。啊,太好了!如何从$editor\u样式数组中删除某些内容?谢谢!我在打印的数组中看到,最后一个元素就是我想要去掉的元素。是否有方法将最后一个元素发送到数组的开头?那就更好了!我已经编辑了上面的答案。这会将项目移到开头。不过你必须改变索引。