Title: Admin check if Tinymce
Last modified: August 21, 2016

---

# Admin check if Tinymce

 *  [Josh](https://wordpress.org/support/users/josh401/)
 * (@josh401)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/admin-check-if-tinymce/)
 * I’m hoping Andrew Ozz might see this… but I’ll welcome anyone’s input, respectfully
   🙂
 * Is there a way to check (in admin area) if there is a tinymce editor being initialized
   somewhere on that page?
 * The idea… being able to register and enqueue scripts and styles on all admin 
   pages ONLY when a tinymce editor is used.
 * This may include post, page, add new post, add new page, custom post types, and
   any other admin page (including plugins and themes) where a tinymce editor is
   used.
 * I know this function will determine if the admin screen is a post or page:
 *     ```
       add_action('admin_print_styles', 'add_my_tinymce_button_css');
       function add_my_tinymce_button_css() {
   
           // Get current screen and determine if we are using the editor
           $screen = get_current_screen();
           // If we are editing (adding new) post or page
           if ( $screen->id == 'page' || $screen->id == 'post' ) {
   
               // Register our stylesheet
               // Note: The stylesheet resides in our plugin directory/css/admin.css
               // You may change this to suit your preferences
               wp_register_style('my_tinymce_button_css', plugin_dir_url( __FILE__ ) . ('/css/admin.css'), array());
   
               // Now we enqueue our stylesheet
               wp_enqueue_style('my_tinymce_button_css');
   
               // Depending on when you fire things, you may/may not need to enqueue 'dashicons'
               wp_enqueue_style('dashicons');
           }
       }
       ```
   
 * However… it doesn’t take into account any admin pages where tinymce may be used(
   such as in a plugin or theme admin area). I know I can add the pages manually,
   but I’d have to search every plugin and theme. Impractical.
 * Is there something like `is_tinymce_enqueued()` that can be fired from within
   the `admin_print_styles()` filter?

Viewing 1 replies (of 1 total)

 *  Thread Starter [Josh](https://wordpress.org/support/users/josh401/)
 * (@josh401)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/admin-check-if-tinymce/#post-4743864)
 * Just for posterity.. I found a part-way working solution.
 * The trick is using the `before_wp_tiny_mce()` and `after_wp_tiny_mce()` hooks.
   More can be found here:
    [http://wordpress.stackexchange.com/questions/76195/enqueue-script-after-tinymce-initialized](http://wordpress.stackexchange.com/questions/76195/enqueue-script-after-tinymce-initialized)
 * Thanks to the OP for providing that solution!

Viewing 1 replies (of 1 total)

The topic ‘Admin check if Tinymce’ is closed to new replies.

 * 1 reply
 * 1 participant
 * Last reply from: [Josh](https://wordpress.org/support/users/josh401/)
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/admin-check-if-tinymce/#post-4743864)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
