Possible fix for the WP_DEBUG "doing it wrong" warning
-
I’m testing this code change, what do you think?
ceceppaml.php Version: 1.3.46 Line 999:function enqueue_script_search() { wp_enqueue_script('ceceppa-search', WP_PLUGIN_URL . '/ceceppa-multilingua/js/ceceppa.search.js', array('jquery')); }
change to:
function enqueue_script_search() { wp_enqueue_script('ceceppa-search', WP_PLUGIN_URL . '/ceceppa-multilingua/js/ceceppa.search.js', array('jquery')); $array = array('lang' => $this->_current_lang, 'form_class' => $this->_filter_form_class); wp_localize_script('ceceppa-search', 'cml_object', $array); }
ceceppaml.php Version: 1.3.46 Line 2090:
if( $this->_filter_search ) { //For Fix Notice //add_action('wp_enqueue_scripts', array(&$this, 'enqueue_script_search')); //Non funziona :( $this->enqueue_script_search(); $array = array('lang' => $this->_current_lang, 'form_class' => $this->_filter_form_class); wp_localize_script('ceceppa-search', 'cml_object', $array); }
change to:
if( $this->_filter_search ) { add_action('wp_enqueue_scripts', array(&$this, 'enqueue_script_search')); add_action('admin_enqueue_scripts', array(&$this, 'enqueue_script_search')); }
or even better:
static $script_search_enqueued = 0; if( $this->_filter_search ) { if (! ($script_search_enqueued++)) { add_action('wp_enqueue_scripts', array(&$this, 'enqueue_script_search')); add_action('admin_enqueue_scripts', array(&$this, 'enqueue_script_search')); } }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Possible fix for the WP_DEBUG "doing it wrong" warning’ is closed to new replies.