WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#5612 closed defect (bug) (duplicate)

using wp_register_script generates an error in plugin

Reported by: devil1591 Owned by: westi
Milestone: Priority: normal
Severity: normal Version: 2.5
Component: General Keywords:
Focuses: Cc:

Description

Hi there,
I'm using using lastest svn r6582

When I use wp_register_script inside a plugin, and it generates an error and it wasn't last week :

Fatal error: Call to undefined function: wp_get_current_user() in wp-includes\user.php on line 30.

Same error if I use this inside a plugin :

$wp_scripts = new WP_Scripts();
$wp_scripts->dequeue('tiny_mce');

Change History (7)

comment:1 @devil15917 years ago

  • Summary changed from using wp_register_script generates an error to using wp_register_script generates an error in plugin

comment:2 @westi7 years ago

  • Keywords reporter-feeback added
  • Owner changed from anonymous to westi
  • Status changed from new to assigned

Please provide example code.

Are you calling it before the init hook fires?

comment:3 @devil15917 years ago

Using this sample plugin i'm getting the error.

<?php
/*
Plugin Name: BUG TEST
Version: 1.0
*/

wp_register_script('jscalendar', get_bloginfo('template_directory').'/js/jscalendar/calendar_stripped.js', array(), '1.51');

// this is buggy too
/*
$wp_scripts = new WP_Scripts();
$wp_scripts->dequeue('tiny_mce');
*/

?>

comment:4 @devil15917 years ago

  • Keywords reporter-feeback removed

comment:5 @lloydbudd7 years ago

  • Cc mdawaffe added

Relates to #5605.

comment:6 @mdawaffe7 years ago

  • Resolution set to duplicate
  • Status changed from assigned to closed

I'm going to call this a duplicate of #5605 even though this one correctly diagnoses the problem :) Thanks!

comment:7 @Nazgul7 years ago

  • Milestone 2.5 deleted
Note: See TracTickets for help on using tickets.