Autor Zpráva
sjiamnocna
Profil
Zdravím, chtěl jsem vyzkoušet, co dělá můj Wordpress v pozadí, a zapnul jsem WP_DEBUG a později i WP_DEBUG_LOG, čímž mi vyvstaly dvě upomínky

[20-Jul-2014 09:36:13 UTC] PHP Notice:  wp_register_script was called <strong>incorrectly</strong>. 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 /data/web/virtuals/72282/virtual/www/wp-includes/functions.php on line 3245

tyto dvě jsou identické, pouze se liší tím, že jedna je pro wp_register_style.

Zjistil jsem, že za to může můj plugin WP Songbook, ale narážka na wp_register_style/wp_register_script je jen v jednom souboru:

wp_register_script('songbook_jquery_dragsort',plugins_url().'/wp-songbook/js/jquery.dragsort-0.5.1.min.js',array('jquery'));
  wp_register_script('songbook_files_functions',plugins_url().'/wp-songbook/js/files_fcs.js',array('jquery'));
  wp_register_script('songbook_filebox_script',plugins_url().'/wp-songbook/js/filescript.js',array('jquery','songbook_files_functions'));
//  wp_register_script('songbook_tooltips_script',plugins_url().'/wp-songbook/js/tooltips.js',array('jquery','songbook_jquery_custom'));
  wp_register_style('songbook_jqueryuistyle',plugins_url().'/wp-songbook/css/jqueryui_customstyle.css');
  wp_register_style('songbook_filebox_style',plugins_url().'/wp-songbook/css/filestyle.css');
  wp_register_style('songbook_filetypes_css',plugins_url().'/wp-songbook/css/filetypes.css');
  wp_register_style('songbook_settings_style',plugins_url().'/wp-songbook/css/settstyle.css');
  wp_register_style('songbook_songlist_style',plugins_url().'/wp-songbook/css/songlist.css');
  wp_register_style('songbook_songbase_style',plugins_url().'/wp-songbook/css/songbasics.css');

jsou součástí fce songbook_plugin_init(), spouštěné při akci 'plugins_loaded':
add_action('plugins_loaded','songbook_plugin_init');

Máte někdo nějaký nápad? Moc děkuji :)
alala
Profil
add_action('plugins_loaded','songbook_plugin_init');

vyměň za

add_action( 'wp_enqueue_scripts', 'songbook_plugin_init' );
sjiamnocna
Profil
Funguje :)

Děkuji za pomoc :)

Vaše odpověď


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0