Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Can the wp-plugins (Must Use Plugins) URL be targeted for use in functions.php? I have a mu-functions.php file in the mu-plugins folder. One function calls a javascript file (alerts.js) located in example.com/wp-content/mu-plugins/js/. How can I target the mu-plugins folder in my function?

Currently, I am using get_site_url() . '/wp-content/mu-plugins/js/alerts.js',

Although not completely relevant to the question, this is the complete function used to call the javascript file:

function load_my_alerts(){
      wp_register_script( 
        'my_alerts', 
        get_site_url() . '/wp-content/mu-plugins/js/alerts.js', 
        array( 'jquery' )
    );
    wp_enqueue_script( 'my_alerts' );
}
add_action('admin_enqueue_scripts', 'load_my_alerts');
share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

Use the WPMU_PLUGIN_DIR and WPMU_PLUGIN_URL constants :)

function load_my_alerts(){
    wp_register_script( 
        'my_alerts', 
        WPMU_PLUGIN_URL . '/js/alerts.js', 
        array( 'jquery' )
    );
    wp_enqueue_script( 'my_alerts' );
}
add_action('admin_enqueue_scripts', 'load_my_alerts');
share|improve this answer
    
Thanks. I swear I used that. Maybe I missed the leading slash. –  Travis Pflanz Jan 7 '13 at 23:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.