diff --git a/php/class-plugin.php b/php/class-plugin.php index 8ed2765b..364c3509 100644 --- a/php/class-plugin.php +++ b/php/class-plugin.php @@ -719,7 +719,12 @@ public function add_script_data( $slug, $value, $handle = null ) { * Output script data if set. */ public function print_script_data() { + if ( ! isset( $this->settings ) || ! method_exists( $this->settings, 'get_param' ) ) { + return; + } + $handles = $this->settings->get_param( '@script' ); + if ( ! empty( $handles ) ) { foreach ( $handles as $handle => $data ) { // We should never be using multiple handles. This is just for cases where data needs to be added where the main script is not loaded.