TPC! Memory Usage
Getting an info message (2 posts)

  1. OllieJones
    Posted 2 years ago #

    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.


  2. OllieJones
    Posted 2 years ago #

    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' );

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • TPC! Memory Usage
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.