WordPress.org

Ready to get started?Download WordPress

Forums

Check if user is using visual editor? (2 posts)

  1. jbradforddillon
    Member
    Posted 5 years ago #

    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.

  2. Eric Mann
    Member
    Posted 5 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic