Horje
WYSIWYG Editor - 'HTML' is disabled/inactive? - Wordpress Solution
[Solved] - WYSIWYG Editor - 'HTML' is disabled/inactive? - Wordpress Solution
Try following codes
Hi, I am having an issue with the WYSIWYG editor for pages/posts. The Visual editor works fine but the 'HTML' button seems to be disabled. I am unable to switch to HTML view. Any help is greatly appreciated. Cheers.

Solution - 1

I think you have loaded jquery 1.4.2 on admin side. To load it only on the front-end use this :

add_action  ( 'init' , 'jquery_cdn' );
function jquery_cdn()
{
	if ( !is_admin() )
	{
		wp_deregister_script( 'jquery' );
		wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js' );
		wp_enqueue_script( 'jquery' );
	}
}


Solution - 2

<?php


add_action('init', 'my_init_method');

function my_init_method() {

	if (!is_admin) {
		wp_deregister_script( 'jquery' );
		wp_register_script( 'jquery', THEME_JS .'/jquery.min.js');
	}
}



add_action('wp_print_scripts', 'THEME_scripts');

function THEME_scripts() {

	if (!is_admin) {
		wp_enqueue_script( 'jquery');
		wp_enqueue_script( 'jquery-cycle', THEME_JS .'/jquery.cycle.all.2.74.js', array('jquery'));
		wp_enqueue_script( 'home-modules', THEME_JS .'/home_modules.js', array('jquery'));
		wp_enqueue_script( 'THEME-custom', THEME_JS .'/THEME-custom.js', array('jquery'));
	}
}	
?>
That should do it.


Solution - 3

I can't give you exact answer without seeing what's going on, but if you can't switch editors, you have JavaScript error on the page. When you fix that, it will work again. Use Firefox and Firebug to see it.


Solution - 4

install TinyMCE advances it has way more options


Solution - 5

Hi try this.


function my_init_method() {
    if(!is_admin()){
    wp_deregister_script( 'jquery' );
    wp_register_script( 'jquery', THEME_JS.'/jquery.min.js');
	}
}    
 
add_action('init', 'my_init_method');

function THEME_scripts(){
	if(!is_admin()){

wp_register_script( 'jquery-cycle', THEME_JS .'/jquery.cycle.all.2.74.js', array('jquery'));

		wp_register_script( 'home-modules', THEME_JS .'/home_modules.js', array('jquery'));

		wp_register_script( 'THEME-custom', THEME_JS .'/THEME-custom.js', array('jquery'));


wp_enqueue_script( 'jquery-cycle', THEME_JS .'/jquery.cycle.all.2.74.js', array('jquery'));

		wp_enqueue_script( 'home-modules', THEME_JS .'/home_modules.js', array('jquery'));

		wp_enqueue_script( 'THEME-custom', THEME_JS .'/THEME-custom.js', array('jquery'));
	}
} 

//add script to theme <head>
add_action('init', 'THEME_scripts');
Please note that is_admin() is a function, to check whether it is admin or not. And secondly you got it correct by registering jquery after deregistering. As for other scripts, you need to register them all, before enqueuing them into the of web page. And please note, you do not need to enqueue jQuery before enqueuing other scripts, As the code already states that the new scripts are dependent on jQuery. So WordPress will load jQuery first follow by other scripts you registered and enqueued. My script may have syntax error, as I did not verify on my computer. Hope this helps. Thanks.

Date: 2022-10-21 05:20:53
Category: Wordpress
More for You