Support » Plugins » Check if user is using visual editor?

  • Is there a way to get the current user’s options in the admin?

    I’m writing a plugin and I need to know if the user is using the visual post editor or the basic editor.

    Thanks.

Viewing 1 replies (of 1 total)
  • Short answer: yes.

    You need information out of two tables in the database, wp_users and wp_usermeta. The wp_users table will tell you what user ID maps to which user (by name, nickname, email, etc). The wp_usermeta table defines certain attributes based on user ID. One of these “meta keys” is called “rich_editing” and will either be “true” or “false” depending on their settings.

    You can get user names and user IDs with built-in WP functions (ie get_userdata()). Knowing the user ID, you can run a loop in your plugin to get data from the database … GET ‘meta_value’ WHERE ‘user_id’ = x AND ‘meta_key’ = “true” … or something along those lines.

Viewing 1 replies (of 1 total)
  • The topic ‘Check if user is using visual editor?’ is closed to new replies.