How to remove some external js files from source?

You can use wp_dequeue_script to achieve this assuming they are using wp_enqueue_script to add the scripts in the first place. Learn more about enquene and dequeue: https://developer.wordpress.org/reference/functions/wp_enqueue_script/ https://codex.wordpress.org/Function_Reference/wp_dequeue_script function dequeue_script() { wp_dequeue_script( ‘http://buhehe.de/wp-content/themes/heatt/js/small-menu.js?ver=4.9.1’ ); wp_dequeue_script( ‘http://buhehe.de/wp-includes/js/wp-embed.min.js?ver=4.9.1’ ); } add_action( ‘wp_print_scripts’, ‘dequeue_script’, 100 );

Styles and Scripts, Selectively enqueue across entire site

Right I figured this out myself not sure how “hacky” this is but basically this is the code: public function filter_scripts_styles(){ if(is_page($this->plugin_name)){ //Same name is used for the style as the js file so can reuse this array $allowed = array(‘jquery’, $this->plugin_name.’_scrollpath’, $this->plugin_name); //Check Scripts First global $wp_scripts; foreach($wp_scripts->queue as $handle ) { if(!in_array($handle, $allowed)){ … Read more

How do I enqueue(or delay loading of) tags in individual page posts?

General answer: you can call wp_enqueue_script() directly inline in the template, as of WordPress 3.4 (IIRC). So, if you have: <script src=”https://wordpress.stackexchange.com/questions/82668/myscriptforthispageonly.js”></script> You could replace it with: <?php wp_enqueue_script( ‘this-page-script’, get_template_directory_uri() . ‘/myscriptforthispageonly.js’, array( ‘jquery’ ), null, true ); ?> Edit From this comment: This is from within a page. As in a WordPress page. … Read more

How do I load custom scripts and styles for a page?

Yes, you may add conditional tags to the wp_enqueue_scripts action. See the examples below: function load_assets() { wp_enqueue_style( ‘styles’, get_template_directory_uri() . ‘/css/styles.css’); // loads on any ‘page’ post type if( is_page() ){ wp_enqueue_script(‘main-js’, get_template_directory_uri() . ‘/js/main.js’); } // only loads on the page with a slug of ‘home’ if( is_page(‘home’) ){ wp_enqueue_script(‘home-js’, get_template_directory_uri() . ‘/js/home.js’); … Read more

Serving wp-includes (front-end) javascript from a different domain?

Okay, I’ve tried numerous (literally) codes and methods, and failed miserably. So, like I said in the question, the only safe way seems to be re-registering (unregistering and enqueuing) the scripts. The Scripts: http://mywebsite.com/wp-includes/js/comment-reply.js http://mywebsite.com/wp-includes/js/quicktags.js Should be served from: http://example.com/wp-includes/js/comment-reply.js http://example.com/wp-includes/js/quicktags.js Code in functions.php: add_action(‘wp_enqueue_scripts’,’wpse56742_register_script’); function wpse56742_register_script(){ //Register and enqueue Comment Reply script wp_deregister_script(‘comment-reply’); wp_register_script(‘comment-reply’, … Read more

Listing registered scripts

There’s a global variable called $wp_scripts which is an instance of the WP_Scripts class. It doesn’t have a public API for looking at registered or enqueued scripts, but you can look inside the object and see what’s going on. You can see all the registered scripts with: global $wp_scripts; var_dump( $wp_scripts->registered ); To see the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)