Support » Plugin: Raw HTML » Notice: convert_to_screen(), add_meta_box() was called incorrectly.

  • Receiving this error when using v1.4.15 of the plugin while WP_DEBUG is true:

    Notice: convert_to_screen(), add_meta_box() was called incorrectly. Likely direct inclusion of wp-admin/includes/template.php in order to use add_meta_box(). This is very wrong. Hook the add_meta_box() call into the add_meta_boxes action instead. Please see Debugging in WordPress for more information. (This message was added in version 3.3.)

    I’ve fixed it by adding the following code to the start of page_to_screen_id() in include/screen-options/screen-options.php:

    if( ! class_exists('WP_Screen') ) {
      require_once( ABSPATH . 'wp-admin/includes/screen.php' );
    }

    I’m fairly new to WordPress but this might be due to changes in the way the convert_to_screen() function has evolved over the core WP versions. In template.php it now checks for the existence of the WP_Screen class. Instantiating it here fixes the problem, but I’m not sure this is the best way. Gets rid of the error, anyway.

    https://wordpress.org/plugins/raw-html/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Notice: convert_to_screen(), add_meta_box() was called incorrectly.’ is closed to new replies.