Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/253.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何使wordpress编辑器为只读?_Php_Wordpress_Wp Editor - Fatal编程技术网

Php 如何使wordpress编辑器为只读?

Php 如何使wordpress编辑器为只读?,php,wordpress,wp-editor,Php,Wordpress,Wp Editor,如何使wordpress编辑器像只读输入一样只读。 我使用以下代码在页面中显示编辑器 <?php $args= array( 'quicktags' => false, 'media_buttons' => false ); wp_editor( wpautop(stripslashes($my_text)), "my_text", $args); ?> 在其设置或任何其他方法中可用的任何选项?use可以在初始化之前使用tiny_mce_修改tiny mce参数,将其

如何使wordpress编辑器像只读输入一样只读。 我使用以下代码在页面中显示编辑器

<?php
$args= array( 
'quicktags' => false,
'media_buttons' => false
);
wp_editor( wpautop(stripslashes($my_text)), "my_text", $args);
?>
在其设置或任何其他方法中可用的任何选项?

use可以在初始化之前使用tiny_mce_修改tiny mce参数,将其设置为只读

add_filter( 'tiny_mce_before_init', function( $args ) {

    if ( 1 == 1 )
         $args['readonly'] = 1;

    return $args;
} );

??? 如果是,请阅读手册以了解如何发送属性。pass readonly=>true;我可以问一下为什么1==1是必要的条件吗?@OrelBiton不是。我猜回答者想展示如何使用条件块来指定何时需要只读内容编辑器。我知道这是一个老问题,但我有同样的要求,这个答案对我不适用。我不知道timyMCE代码是否已更改,但readonly属性没有添加到textarea。我可以在页面源代码中看到,它被包含在tinyMCEPreInit对象中,包含在一个名为与选择器相同的属性中,但tinyMCE JS似乎对此没有任何作用。我还尝试向调用wp_编辑器添加一个只读参数,但没有效果。