How can I de-register ALL styles all at once? And same with Javascript?

I hope you know what you are doing. You can use the wp_print_styles and wp_print_scripts action hooks and then get the global $wp_styles and $wp_scripts object variables in their respective hooks. The “registered” attribute lists registered scripts and the “queue” attribute lists enqueued scripts on both of the above objects. An example code to empty … Read more

How can I remove the site URL from enqueued scripts and styles?

Similar to Wyck’s answer, but using str_replace instead of regex. script_loader_src and style_loader_src are the hooks you want. <?php add_filter( ‘script_loader_src’, ‘wpse47206_src’ ); add_filter( ‘style_loader_src’, ‘wpse47206_src’ ); function wpse47206_src( $url ) { if( is_admin() ) return $url; return str_replace( site_url(), ”, $url ); } You could also start the script/style URLs with a double slash … Read more

Can’t enqueue scripts in the footer?

Where did you put your code ? the “true” arguments goes in the wp_register_script();, not the wp_enqueue_script() ; the functions is: <?php wp_enqueue_script(‘handle’, ‘src’, ‘deps’, ‘ver’, ‘in_footer’); ?> meaning <?php wp_enqueue_script(‘NameMySccript’, ‘path/to/MyScript’, ‘dependencies_MyScript’, ‘VersionMyScript’, ‘InfooterTrueorFalse’); ?> E.G. <?php wp_enqueue_script(‘my_script’, WP_CONTENT_URL . ‘plugins/my_plugin/my_script.js’, array(‘jquery’, ‘another_script’), ‘1.0.0’, true); ?> does your theme have <?php wp_footer(); ?> at … Read more

How can I enqueue protocol relative external (//ajax.googleapis.com/…) scripts?

The code you posted works fine and results in this in the HTML output: <script type=”text/javascript” src=”https://maps.googleapis.com/maps/api/js?sensor=false&#038;ver=3″></script> Tested on WordPress 3.5 with this code snippet: add_action(‘wp_enqueue_scripts’, ‘test’); function test() { wp_enqueue_script(‘google-maps’, ‘//maps.googleapis.com/maps/api/js?&sensor=false’, array(), ‘3’, true); }

Register a script to be enqueued both in admin and front end

You can register the scripts earlier, for example on wp_loaded: add_action( ‘wp_loaded’, ‘register_all_scripts’ ); function register_all_scripts() { wp_register_script(…); } And then you enqueue the scripts whenever you need them: add_action( ‘wp_enqueue_scripts’, ‘enqueue_front_scripts’ ); add_action( ‘admin_enqueue_scripts’, ‘enqueue_back_scripts’ ); Use the same handles and names to avoid collisions with other scripts.

Prevent Version URL Parameter (?ver=X.X.X) on Enqueued Styles & Scripts

Default wp_enqueue_[style/script]() behavior The default value for the $version argument of wp_enqueue_style() is false. However, that default just means that the stylesheets are given the WordPress version instead. Solution Thanks to “Remove version from WordPress enqueued CSS and JS”, I learned the undocumented fact that passing in null as a version will remove the version … Read more

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