Remove Editor From Homepage

There are a couple of issues with your approach By using the admin_init hook you won’t have any reference to the post object. This means you won’t be able to get the post ID or use anything like get_the_ID because the post won’t actually be loaded. You can see that in the order here https://codex.wordpress.org/Plugin_API/Action_Reference … Read more

Hide page visual editor if certain template is selected?

add_action( ‘init’, ‘remove_editor_init’ ); function remove_editor_init() { // If not in the admin, return. if ( ! is_admin() ) { return; } // Get the post ID on edit post with filter_input super global inspection. $current_post_id = filter_input( INPUT_GET, ‘post’, FILTER_SANITIZE_NUMBER_INT ); // Get the post ID on update post with filter_input super global inspection. … Read more

How to get back distraction-free mode we had before WP 4.1?

Edit As of WP 4.3 this won’t work anymore. WP have completely removed the javascript for the old distraction-free mode. To use this in 4.3 versions, get a copy of javascript file from WP 4.2 release and enqueue it before using code below. You can: use ‘wp_editor_settings’ filter to set the ‘_content_editor_dfw’ option to false. … Read more

WordPress Visual Editor Stripping HTML Changes

Background This issue revolves around the removal of empty <span></span> elements in TinyMCE when saving a post or switching between between the Visual and Text editor tabs. The problem is inherent to core functionality (as of trunk version 4.0-alpha-20140602) and is unchangeable via the standard WordPress APIs, as is mentioned in ticket #26986. The ticket … Read more

Can you add the visual editor to the description field for custom taxonomies?

Just wrote the function. It’ll display the tinymce editor in every custom taxonomy description right now. Surely you can edit to show it for only some specific taxonomy. /** * Display advanced TinyMCE editor in taxonomy page */ function wpse_7156_enqueue_category() { global $pagenow, $current_screen; if( $pagenow == ‘edit-tags.php’ ) { require_once(ABSPATH . ‘wp-admin/includes/post.php’); require_once(ABSPATH . … Read more

how to fix a broken visual editor

This almost certainly happens because WordPress cannot load the TinyMCE editor files or the TinyMCE javascript code could not be run. Try these things: 1) Make sure your browser has javascript enabled! 2) Open this URL in your browser http://<yoursite>/wp-includes/js/tinymce/wp-tinymce.php You should see a lot of text, starting something like this: // 4.0.21.1 (2014-04-09) !function(e,t){“use … Read more

Forcing reload of editor-style.css

There is a hook for that: ‘mce_css’. It is called in _WP_Editors::editor_settings() and you get all loaded stylesheets comma separated as the first and only parameter. Now it is easy: Use the global variable $editor_styles (here are your theme’s and parent theme’s editor stylesheets stored already), add the time of the file’s last modification as … Read more