WordPress editor missing when using CloudFront

We often put CloudFront in front of our WordPress sites to increase the load times of the website significantly.

CloudFront and WordPress have a few quirks, the main one will be the missing rich post/page editor that suddenly goes missing from your wp-admin.

The issue comes down to the UA sniffing that WordPress does.

Adding this into your functions.php will be a good quick fix for you

/**
* Ignore UA Sniffing and override the user_can_richedit function
* and just check the user preferences
*
* @return bool
*/
function user_can_richedit_override() {  
    global $wp_rich_edit;

    if (get_user_option('rich_editing') == 'true' || !is_user_logged_in()) {
        $wp_rich_edit = true;
        return true;
    }

    $wp_rich_edit = false;
    return false;
}

add_filter('user_can_richedit', 'user_can_richedit_override');  
comments powered by Disqus