• Resolved SussieT

    (@sussiet)


    I get

    Notice: wp_register_style 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 /var/www/web131/web/wp-includes/functions.php on line 3049

    when activating the plugin. I am using WP 3.8. With empty form fields in the plugins settings page. Used to work before upgrading.

    https://www.ads-software.com/plugins/insert-headers-and-footers/

Viewing 5 replies - 1 through 5 (of 5 total)
  • I was able to fix this by moving lines 18-21 of ihaf.php into the init() function.

    function init() {
    			load_plugin_textdomain( 'insert-headers-and-footers', false, dirname( plugin_basename ( __FILE__ ) ).'/lang' );
            	if (is_admin()) {
            		wp_register_style('IHAFStyleSheet', IHAFURL . '/ihaf.css');
            		wp_enqueue_style( 'IHAFStyleSheet');
            	}
    		}

    Actually, it probably makes more sense to move it into admin_init() and get rid of the is_admin() check.

    Thread Starter SussieT

    (@sussiet)

    I’ll try that.
    Is it a fix while waiting for next update? Are you the developer or another user with same problem?

    Thread Starter SussieT

    (@sussiet)

    Works beautifully! Used the is_admin().

    This is fixed in version 1.3.1, so you don’t need to modify the plugin code.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘wp_register_style error’ is closed to new replies.