Support » Developing with WordPress » WP Editor ReadOnly

  • Resolved loopforever

    (@loopforever)


    Hello,
    I am working on a multi-vendor marketplace. I have an editor where I show sellers the rules about refund. This can also be displayed with a textarea, but as you know, HTML codes are not read.
    The question I want to ask is: Can wp_editor be made read-only? I searched but couldn’t find an answer.

    My code line:
    <?php wp_editor( $rma_settings['policy'], 'refund_policy', [ 'editor_height' => 50, 'quicktags' => false, 'media_buttons' => false, 'teeny' => true, 'editor_class' => 'refund_policy' ] ); ?>

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Use the ‘the_editor’ filter to insert a readonly attribute into the textarea tag. Search for '">%s</textarea></div>' and replace it with this '" readonly >%s</textarea></div>'

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.