Go Back    Forum > Digital Publishing / Web Sites > Website and Server Troubleshooting

Reply
 
LinkBack Thread Tools
  #1  
09-24-2012, 01:50 AM
kpmedia's Avatar
kpmedia kpmedia is offline
Site Staff | Web Hosting, Photo
 
Join Date: Feb 2004
Posts: 4,311
Thanked 374 Times in 341 Posts
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.

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.

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.

____________________


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.


- Did my advice help you? Then become a Premium Member and support this site.
- Please Like Us on Facebook | Follow Us on Twitter

- Need a good web host? Ask me for help! Get the shared, VPS, semi-dedicated, cloud, or reseller you need.
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Upgrading a WordPress 2.x theme to WordPress 3.4.x compliance kpmedia Website and Server Troubleshooting 0 09-23-2012 04:22 PM
Problem editing pages in WordPress, visual editor is not opening! faustine Website and Server Troubleshooting 9 06-05-2012 11:02 PM
MySQL query to disable comments on WordPress posts/pages admin Website and Server Troubleshooting 0 10-02-2011 06:07 PM
Video editor capable of drawing circles w3tno Edit Video, Audio 4 09-18-2011 12:55 AM
Wordpress wp-admin login loop [SOLVED] admin Website and Server Troubleshooting 0 10-08-2009 02:20 PM

Thread Tools



 
All times are GMT -5. The time now is 05:07 AM