WordPress.org

Support

Support » Plugins and Hacks » TPC! Memory Usage » Getting an info message

Getting an info message

  • Getting this message:

    ( ! ) Notice: wp_register_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks.

    Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in …\wp-includes\functions.php on line 3049

    The traceback implicates tpcmem.php line 95.

    https://wordpress.org/plugins/tpc-memory-usage/

Viewing 1 replies (of 1 total)
  • This change to tcpmem.php fixes the information warning.

    // Add script-registration action
    add_action( 'init', 'tcpmem_enqueue_scripts' );
    
    function tcpmem_enqueue_scripts () {
        // Register scripts and styles
        wp_register_script('tpcmem', plugins_url('tpc-memory-usage/js/tpcmem.js'), array('jquery'), TPCMEM_VERSION, true);
        wp_register_script('tpcmem-overview', plugins_url('tpc-memory-usage/js/overview.js'), array('jquery-ui-tabs'), TPCMEM_VERSION, true);
        wp_register_script('tpcmem-tablesorter', plugins_url('tpc-memory-usage/js/jquery.tablesorter.min.js'), array('jquery'), '2.0.3', true);
        wp_register_script('tpcmem-reports', plugins_url('tpc-memory-usage/js/reports.js'), array('tpcmem-tablesorter'), TPCMEM_VERSION, true);
        wp_register_style('tpcmem', plugins_url('tpc-memory-usage/css/tpcmem.css'), array(), TPCMEM_VERSION);
    }

    Note that the dashboard doesn’t work correctly if you use

    add_action( 'wp_enqueue_scripts', 'tcpmem_enqueue_scripts' );

    instead of

    add_action( 'init', 'tcpmem_enqueue_scripts' );

Viewing 1 replies (of 1 total)
  • The topic ‘Getting an info message’ is closed to new replies.
Skip to toolbar