WordPress.org

Ready to get started?Download WordPress

Forums

Social Connect
[resolved] Plugin makes wp_print_scripts run mulitple times (2 posts)

  1. Morten Hauan
    Member
    Posted 2 years ago #

    I have some functions hooked in to wp_print_scripts and when this plugin is activated the hook runs multiple times in the header. I think I have located the problem, and it is because the scripts is loaded width wp_print_scripts.

    I have a sugestion for a fix in the media.php file. You should use wp_enqueue_script instead of wp_print_scripts. My solution was to change the last lines of media.php to:

    function sc_add_javascripts(){
    	if( !wp_script_is( 'social_connect', 'registered' ) ) {
    		wp_register_script( "social_connect", SOCIAL_CONNECT_PLUGIN_URL . "/media/js/connect.js", array("jquery", "jquery-ui-core", "jquery-ui-dialog") );
    	}
    	wp_enqueue_script( "social_connect" );
    }
    add_action( 'login_head', 'sc_add_javascripts' );
    add_action( 'wp_enqueue_scripts', 'sc_add_javascripts' );

    http://wordpress.org/extend/plugins/social-connect/

  2. thenbrent
    Member
    Plugin Author

    Posted 2 years ago #

    Right you are, thanks for the fix mhauan. :) This will be included in the next release.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic