0
votes

I have wordpress 5.7 and upgraded wordpress, theme and plugin but still not displaying visual/text button in editor

so, I have checked core files of wordpress and in wp-includes/class-wp-editor.php

line 179

if ( self::$this_tinymce ) {
}

not going in this condition

so in line 107

self::$this_tinymce = ( $set['tinymce'] && user_can_richedit() );

user_can_richedit() is false. so what is the reason of it?

I have tried to changing theme but still same issue

1

1 Answers

0
votes

Following line of code fixed issue

function custom_user_can_richedit() {
    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', 'custom_user_can_richedit');