Title: [Plugin: Basic Comment Quicktags] Change Quicktags JavaScript File URL
Last modified: August 20, 2016

---

# [Plugin: Basic Comment Quicktags] Change Quicktags JavaScript File URL

 *  Resolved [Aahan Krish](https://wordpress.org/support/users/aahan/)
 * (@aahan)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-basic-comment-quicktags-change-quicktags-javascript-file-url/)
 * I am serving all my static content from a different domain, and am facing one
   small problem with the plugin (NOT a bug, just my problem).
 * The quicktags JS file (`http://example.com/wp-includes/js/quicktags.js`) is being
   served from the same domain as my website. How can I have it served from a different
   domain, say, `example2.com`?
 * I tried deregistering, then changing the src of the file, and enqueuing `quicktags`,
   but that seems to be messing with the plugin.
 * It would be great if someone can provide me the function that allows me to properly
   change the URL of the quicktags core JS file.
 * [http://wordpress.org/extend/plugins/basic-comment-quicktags/](http://wordpress.org/extend/plugins/basic-comment-quicktags/)

Viewing 12 replies - 1 through 12 (of 12 total)

 *  Plugin Author [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-basic-comment-quicktags-change-quicktags-javascript-file-url/#post-2853914)
 * Huh. Well, the catch there is that most (well written) plugins are relatively
   looking for your wp-content folder. In this case, I used plugin_dir_url:
 * `wp_enqueue_script("bcq_quicktags", plugin_dir_url(__FILE__) . "quicktags.js",
   array("quicktags","jquery"), "1.8", 1);`
 * It should be rendering as `http://example.com/wp-content/plugins/basic-comment-
   quicktags/quicktags.js` by the way…
 * So is the issue that your wp-content is in another location? How are you telling
   WP right now where to go for Static Content? If you’d used a define in your wp-
   config, that should have been picked up.
 *  Thread Starter [Aahan Krish](https://wordpress.org/support/users/aahan/)
 * (@aahan)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-basic-comment-quicktags-change-quicktags-javascript-file-url/#post-2853990)
 * Hello Mika,
 * I am talking about **`wp-includes`** and NOT `wp-content` directory. And since
   you asked, I’ve set a different domain for the `wp-content` directory [by adding this](http://codex.wordpress.org/Editing_wp-config.php#Moving_wp-content)
   in my wp-config.php:
 * `define( 'WP_CONTENT_URL', 'http://static-content.com/wp-content');`
 * But that doesn’t change the URLs of JavaScript files loaded from **`wp-includes`**
   to the new domain. And as there’s no such thing as `WP_INCLUDES_URL`, I have 
   to manually un/de-register each handle and have it enqueued with the static domain(
   from the e.g. static-content.com).
 * The handle for `http://example.com/wp-includes/js/quicktags.js` which the [Basic Comment Quicktags](http://wordpress.org/extend/plugins/basic-comment-quicktags/)
   plugin uses (as a dependency) is [**`quicktags`**](http://codex.wordpress.org/Function_Reference/wp_register_script#Notes),
   and trying to un/de-register the handle and enqueuing it with the static domain
   somehow breaks the plugin’s CDATA JS output in the footer.
 * What I am asking is, what is the proper way to have this file — `http://example.
   com/wp-includes/js/quicktags.js` — served from the domain that serves static 
   files, i.e. like this — `http://static-domain.com/wp-includes/js/quicktags.js`
 * I would be very helpful if you can give me the proper function/code to un-register
   and enqueue the handle (quicktags), as my method seems to break the plugin.
 * Hope I am clear enough this time. 🙂
 *  Plugin Author [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-basic-comment-quicktags-change-quicktags-javascript-file-url/#post-2853994)
 * Yeah, that’s this part `array("quicktags","jquery")`
 * That’s WP’s own code, and … you’d have to move it. You’d have to deregister quicktags
   itself and register your own for that.
 *  Thread Starter [Aahan Krish](https://wordpress.org/support/users/aahan/)
 * (@aahan)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-basic-comment-quicktags-change-quicktags-javascript-file-url/#post-2853995)
 * Yes, that’s what I am asking. How do I do that? Something’s wrong with the way
   I am doing it. This is what I’ve tried (and some variants of it as well, actually):
 *     ```
       add_action('wp_enqueue_scripts','aahan_register_script');
       function aahan_register_script(){
   
       	wp_deregister_script('quicktags');
       	wp_register_script('quicktags', 'http://static-domain.com/wp-includes/js/quicktags.js', false, false);
       	wp_enqueue_script( 'quicktags' );
   
       }
       ```
   
 * Is something wrong with the way I am doing it?
 *  Thread Starter [Aahan Krish](https://wordpress.org/support/users/aahan/)
 * (@aahan)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-basic-comment-quicktags-change-quicktags-javascript-file-url/#post-2853998)
 * OR it would be great if you can tell me how to replace this function (from your
   plugin) with some code in my function.php (sorry, I am not that good with PHP,
   but I am just into learning it):
 *     ```
       function ippy_bcq_add_scripts() {
   
       $options = get_option('ippy_bcq_options');
       $valuebb = $options['bbpress'];
       $valueco = $options['comments'];
       $ippy_bcq_bbp_fancy = get_option( '_bbp_use_wp_editor' );
   
         if ( function_exists('is_bbpress') ) {
                 if ( is_bbpress()  && ( $valuebb != '0') && !is_null($valuebb) && ($ippy_bcq_bbp_fancy == '0') ) {
                   wp_enqueue_script("bcq_quicktags", plugin_dir_url(__FILE__) . "quicktags.js", array("quicktags","jquery"), "1.8", 1);
                   wp_enqueue_style("bcq_quicktags", plugin_dir_url(__FILE__) . "quicktags.css", false, "1.8");
                   wp_print_styles('editor-buttons');
               }
         }
         if ( comments_open() && is_singular() && ( $valueco != '0') && !is_null($valueco) ) {
                           wp_enqueue_script("bcq_quicktags", plugin_dir_url(__FILE__) . "quicktags.js", array("quicktags","jquery"), "1.8", 1);
                           wp_enqueue_style("bcq_quicktags", plugin_dir_url(__FILE__) . "quicktags.css", false, "1.8");
                           wp_print_styles('editor-buttons');
         }
       }
   
       if( !is_admin() ) {
       	add_action('wp_print_styles', 'ippy_bcq_add_scripts');
       }
       ```
   
 *  Plugin Author [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-basic-comment-quicktags-change-quicktags-javascript-file-url/#post-2853999)
 * What you have two posts up should work.
 * I wonder if my code is getting called before yours and that’s why…I’d try setting
   a lower priority.
 * Or if I was really lazy, an .htaccess rule to redirect that file.
 * What file are you putting that code in? Your themes functions.php?
 *  Thread Starter [Aahan Krish](https://wordpress.org/support/users/aahan/)
 * (@aahan)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-basic-comment-quicktags-change-quicktags-javascript-file-url/#post-2854001)
 * Yes, in my theme functions.php.
 * **EDIT:** I also tried lower priority numbers (as low as 1). Doesn’t change anything.
 *  Thread Starter [Aahan Krish](https://wordpress.org/support/users/aahan/)
 * (@aahan)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-basic-comment-quicktags-change-quicktags-javascript-file-url/#post-2854002)
 * By the way, I also tried using `wp_print_styles` instead of `wp_enqueue_scripts`,
   still no luck.
 *  Plugin Author [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-basic-comment-quicktags-change-quicktags-javascript-file-url/#post-2854075)
 * *ponder*
 * Why not move the plugins directory back?
 * `define( 'WP_PLUGIN_URL', 'http://example/wp-content/plugins');`
 * I suggest this because plugins (and themes) aren’t ‘static’ content. The intent
   of the WP_CONTENT_URL changability is to move your content from /home/aahan/public_html/
   wp-content/ to /home/aahan/wp-content/ (i.e. outside of ‘root’) which makes things
   unlinkable and more secure (arguably). I’m not entirely sure totally changing
   the domain was the intent.
 *  Thread Starter [Aahan Krish](https://wordpress.org/support/users/aahan/)
 * (@aahan)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-basic-comment-quicktags-change-quicktags-javascript-file-url/#post-2854077)
 * 🙁 Sad, but kinda makes sense. Thanks for your time Mika 🙂
 *  Thread Starter [Aahan Krish](https://wordpress.org/support/users/aahan/)
 * (@aahan)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-basic-comment-quicktags-change-quicktags-javascript-file-url/#post-2854194)
 * After lots of looking into files, and asking questions, it finally struck me…
   this is how it needs to be done:
 *     ```
       add_action('wp_enqueue_scripts','aahank_register_script');
       function aahank_register_script(){
   
       //Re-register quicktags script
       wp_deregister_script('quicktags');
       wp_register_script('quicktags', 'http://static-content.com/wp-includes/js/quicktags.js', false, false, true);
       wp_localize_script( 'quicktags', 'quicktagsL10n', array(
       	'wordLookup' => __('Enter a word to look up:'),
       	'dictionaryLookup' => esc_attr(__('Dictionary lookup')),
       	'lookup' => esc_attr(__('lookup')),
       	'closeAllOpenTags' => esc_attr(__('Close all open tags')),
       	'closeTags' => esc_attr(__('close tags')),
       	'enterURL' => __('Enter the URL'),
       	'enterImageURL' => __('Enter the URL of the image'),
       	'enterImageDescription' => __('Enter a description of the image'),
       	'fullscreen' => __('fullscreen'),
       	'toggleFullscreen' => esc_attr( __('Toggle fullscreen mode') ),
       	'textdirection' => esc_attr( __('text direction') ),
       	'toggleTextdirection' => esc_attr( __('Toggle Editor Text Direction') )
       ));
   
       }
       ```
   
 * As for the code used in `wp_localize_script`, I got it straight from source: 
   [http://core.svn.wordpress.org/trunk/wp-includes/media.php](http://core.svn.wordpress.org/trunk/wp-includes/media.php)
 * **PS:** Cross-posted from [http://wordpress.stackexchange.com/q/56742/10691](http://wordpress.stackexchange.com/q/56742/10691)
 *  Plugin Author [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-basic-comment-quicktags-change-quicktags-javascript-file-url/#post-2854200)
 * Yow! What a hassle 🙁

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘[Plugin: Basic Comment Quicktags] Change Quicktags JavaScript File URL’
is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/basic-comment-quicktags_dfc2c1.svg)
 * [Basic Comment Quicktags](https://wordpress.org/plugins/basic-comment-quicktags/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/basic-comment-quicktags/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/basic-comment-quicktags/)
 * [Active Topics](https://wordpress.org/support/plugin/basic-comment-quicktags/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/basic-comment-quicktags/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/basic-comment-quicktags/reviews/)

 * 12 replies
 * 2 participants
 * Last reply from: [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * Last activity: [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-basic-comment-quicktags-change-quicktags-javascript-file-url/#post-2854200)
 * Status: resolved