How to *disable* the post content editor

I think the best way is remove it and then print the content out of any textarea, but just as html: add_action(‘load-post.php’, ‘read_only_content’); function read_only_content() { if ( ! current_user_can(‘manage_options’) ) { // change the cap with the wanted one $scr = get_current_screen(); remove_post_type_support( $scr->post_type, ‘editor’ ); add_action(‘edit_form_after_editor’, ‘print_the_content’); } } function print_the_content( $post ) … Read more

How to apply editor filter to posts with a specific custom post type

You can determine the current post type using get_post_type() inside the callback function hooked to wp_default_editor: add_filter( ‘wp_default_editor’, ‘wpse242896_wp_default_editor’ ); function wpse242896_wp_default_editor( $editor ) { $post_type = get_post_type(); if ( ‘custom_post_type’ === $post_type ) { return ‘html’; } else if ( ‘other_post_type’ === $post_type ) { return ‘tinymce’; } return $editor; } Also, anonymous functions … Read more

Set default text for the editor in new posts

There is a filter named default_content. It does exactly what the name says. 🙂 Example: add_filter( ‘default_content’, ‘t5_preset_editor_content’, 10, 2 ); /** * Fills the default content for post type ‘post’ if it is not empty. * * @param string $content * @param object $post * @return string */ function t5_preset_editor_content( $content, $post ) { … Read more

Showing only certain buttons on tinymice content editor

Hi @JosĂ© Pablo Orozco MarĂ­n: If you are looking for how to code the custom buttons yourself, WordPress’ Codex has a great example that shows you how: http://codex.wordpress.org/TinyMCE_Custom_Buttons The example is complicated because it shows you how to add your own controls but if you are using the standard buttons you don’t need to make … Read more

Making the Post/Page Content Editor Box Bigger?

You have a couple of options. First, you can always click on the bottom right corner of the post edit box and drag to resize: However, you can also make it so that the post box is larger by default. Go to Settings > Writing, and change the value for size of the post box:

line break are not working when editing a post [closed]

You’ve stumbled across a ‘hidden’ feature of WordPress and TinyMCE (the visual editor) it has a problem with line breaks and strips them out. Try either of these two plugins: http://wordpress.org/extend/plugins/line-break-shortcode/ http://wordpress.org/extend/plugins/simple-breaks/

Text cut off on save

Your browser doesn’t send the copied text UTF-8 encoded to the server. On the first character that isn’t UTF-8 compatible, in your example the apostrophe – ’ –, the stream to the data base is broken and not recovered. That’s a browser issue. If I had to guess – well, I have because you didn’t … Read more

Open posts in editor in the ‘Text’ mode by default

Add the following line to your theme’s functions.php: add_filter( ‘wp_default_editor’, create_function( ”, ‘return “html”;’ ) ); Use “html” to set the Text editor tab as default (as shown above), or “tinymce” to set the Visual editor tab as default.