Title: user_can_richedit
Published: April 25, 2014
Last modified: February 24, 2026

---

# user_can_richedit(): bool

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/user_can_richedit/?output_format=md#description)
 * [Return](https://developer.wordpress.org/reference/functions/user_can_richedit/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/user_can_richedit/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/user_can_richedit/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/user_can_richedit/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/user_can_richedit/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/user_can_richedit/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/user_can_richedit/?output_format=md#wp--skip-link--target)

Determines whether the user can access the visual editor.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/user_can_richedit/?output_format=md#description)󠁿

Checks if the user can access the visual editor and that it’s supported by the user’s
browser.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/user_can_richedit/?output_format=md#return)󠁿

 bool True if the user can access the visual editor, false otherwise.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/user_can_richedit/?output_format=md#source)󠁿

    ```php
    function user_can_richedit() {
    	global $wp_rich_edit, $is_gecko, $is_opera, $is_safari, $is_chrome, $is_IE, $is_edge;

    	if ( ! isset( $wp_rich_edit ) ) {
    		$wp_rich_edit = false;

    		if ( 'true' === get_user_option( 'rich_editing' ) || ! is_user_logged_in() ) { // Default to 'true' for logged out users.
    			if ( $is_safari ) {
    				$wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && (int) $match[1] >= 534 );
    			} elseif ( $is_IE ) {
    				$wp_rich_edit = str_contains( $_SERVER['HTTP_USER_AGENT'], 'Trident/7.0;' );
    			} elseif ( $is_gecko || $is_chrome || $is_edge || ( $is_opera && ! wp_is_mobile() ) ) {
    				$wp_rich_edit = true;
    			}
    		}
    	}

    	/**
    	 * Filters whether the user can access the visual editor.
    	 *
    	 * @since 2.1.0
    	 *
    	 * @param bool $wp_rich_edit Whether the user can access the visual editor.
    	 */
    	return apply_filters( 'user_can_richedit', $wp_rich_edit );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/general-template.php#L3906)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/general-template.php#L3906-L3931)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/user_can_richedit/?output_format=md#hooks)󠁿

 [apply_filters( ‘user_can_richedit’, bool $wp_rich_edit )](https://developer.wordpress.org/reference/hooks/user_can_richedit/)

Filters whether the user can access the visual editor.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/user_can_richedit/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_is_mobile()](https://developer.wordpress.org/reference/functions/wp_is_mobile/)`wp-includes/vars.php` |

Test if the current browser runs on a mobile device (smart phone, tablet, etc.).

  | 
| [get_user_option()](https://developer.wordpress.org/reference/functions/get_user_option/)`wp-includes/user.php` |

Retrieves user option that can be either per Site or per Network.

  | 
| [is_user_logged_in()](https://developer.wordpress.org/reference/functions/is_user_logged_in/)`wp-includes/pluggable.php` |

Determines whether the current visitor is a logged in user.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

[Show 2 more](https://developer.wordpress.org/reference/functions/user_can_richedit/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/user_can_richedit/?output_format=md#)

| Used by | Description | 
| [_WP_Editors::print_default_editor_scripts()](https://developer.wordpress.org/reference/classes/_wp_editors/print_default_editor_scripts/)`wp-includes/class-wp-editor.php` |

Print (output) all editor scripts and default settings.

  | 
| [get_media_item()](https://developer.wordpress.org/reference/functions/get_media_item/)`wp-admin/includes/media.php` |

Retrieves HTML form for modifying the image attachment.

  | 
| [get_compat_media_markup()](https://developer.wordpress.org/reference/functions/get_compat_media_markup/)`wp-admin/includes/media.php` |  | 
| [wp_default_editor()](https://developer.wordpress.org/reference/functions/wp_default_editor/)`wp-includes/general-template.php` |

Finds out which editor should be displayed by default.

  | 
| [WP_Widget_Text::form()](https://developer.wordpress.org/reference/classes/wp_widget_text/form/)`wp-includes/widgets/class-wp-widget-text.php` |

Outputs the Text widget settings form.

  | 
| [sanitize_post_field()](https://developer.wordpress.org/reference/functions/sanitize_post_field/)`wp-includes/post.php` |

Sanitizes a post field based on context.

  | 
| [_WP_Editors::parse_settings()](https://developer.wordpress.org/reference/classes/_wp_editors/parse_settings/)`wp-includes/class-wp-editor.php` |

Parse default arguments for the editor instance.

  |

[Show 2 more](https://developer.wordpress.org/reference/functions/user_can_richedit/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/user_can_richedit/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/user_can_richedit/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/user_can_richedit/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/functions/user_can_richedit/?output_format=md#comment-content-1423)
 2.   [Codex](https://profiles.wordpress.org/codex/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/user_can_richedit/#comment-1423)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fuser_can_richedit%2F%23comment-1423)
    Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fuser_can_richedit%2F%23comment-1423)
 4. **Example**
 5. Display an editor if the user can use it:
 6.     ```php
        if ( user_can_richedit() ) {
            wp_editor( $content, 'mycustomeditor' );
        } else {
            echo __( 'You cannot use the rich editor', 'textdomain' );
        }
        ```
    
 7.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fuser_can_richedit%2F%3Freplytocom%3D1423%23feedback-editor-1423)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fuser_can_richedit%2F)
before being able to contribute a note or feedback.