digitalFAQ.com Forum

digitalFAQ.com Forum (https://www.digitalfaq.com/forum/)
-   Website and Server Troubleshooting (https://www.digitalfaq.com/forum/web-tech/)
-   -   WordPress visual editor blank? Cannot edit or make posts! [Solved] (https://www.digitalfaq.com/forum/web-tech/4589-wordpress-visual-editor.html)

kpmedia 09-24-2012 01:50 AM

WordPress visual editor blank? Cannot edit or make posts! [Solved]
 
I was developing, debugging and updating a WordPress site tonight, and all seemed to be going smoothly.

As always, I follow proper protocol for updating a WordPress site:
(1) Disable all plugins before updating,
(2) Revert to a boring default theme, and
(3) Make the upgrade.

When that's done, I can slowly turn on plugins one by one, and see if the WordPress backend barfs. I'll visit the options/settings pages for each plugin, or test functionality if it's an admin-area plugin. If all appears well from the backside, it's safe to re-enable the custom theme, and then verify each plugin is working as desired from the front end (i.e., the WordPress site). All of that seemed to go well...

... and then went I went to edit a post or page, the window was empty. No visual editor. No HTML editor.

Oops. :o

Now a lot of hamfisted hosts and amateur/unskilled website designers/developers will immediately blame plugins and themes, phase of the moon, etc -- but that's all nonsense. WordPress conflicts are, quite simply put, an issue with either (A) deprecated code, or (B) conflicting code. Most are quite easily fixed, and many are of your own doing. After some troubleshooting, I found it to be a WordPress editor code conflict.

By process of elimination -- meaning I disabling all plugins, and again enabled them one at a time to see when the editor stoped working -- I found that the jQuery Colorbox plugin was a potential culprit, and I scanned it for code that either added functionality to or somehow altered the MCE editor (aka WordPress editor, aka visual editor).

In plugins\jquery-colorbox\includes\jquery-colorbox-backend.php, the following code adds jQuery Colorbox to the editor:
Code:

    //add style selector dropdown to TinyMCE
    add_filter('mce_buttons_2', array(& $this, 'addStyleSelectorBox'), 100);
    //add Colorbox CSS class to TinyMCE dropdown box
    add_filter('mce_css', array(& $this, 'addColorboxLinkClass'), 100);

... and I saw what the problem was immediately. :cool:

In my theme's functions.php file, I had added some entries to expand the MCE editor:
Code:

function enable_more_buttons($buttons) {
  $buttons[] = 'hr';
  $buttons[] = 'sub';
  $buttons[] = 'sup';
  $buttons[] = 'fontselect';
  $buttons[] = 'fontsizeselect';
  $buttons[] = 'cleanup';
  $buttons[] = 'styleselect';
  return $buttons;
}
add_filter("mce_buttons_3", "enable_more_buttons");

Note the styleselect function (aka addStyleSelectorBox) present in both places. These were conflicting. It was essentially calling for the same code twice, which crashed the editor. The fix was to simply comment out the added variable from the theme functions file.
Code:

//  $buttons[] = 'styleselect';
... noting that I prefer to comment out code, and NOT remove it, in case something needs to be reverted at a later date. Deleting and altering code without backup can sometimes make a huge mess. So always comment out if it doesn't pose a security risk. In this case, it certainly does not.

Problem solved. :thumb:

____________________


Need a good web host? — Read our 2018 Review of the Best Web Hosts
Quite often, problems with web sites are caused by having a rotten web host. Worse yet, many hosts try to blame you (the customer) for the problems! So dump that lousy company. Say goodbye to slow sites, unresponsive support techs, and downtime. Find yourself a new host today. Whether you need shared, reseller, VPS, semi-dedicated, cloud, or dedicated hosting, something on our list should be a good upgrade for you.



All times are GMT -5. The time now is 01:41 AM

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.