How to load plugin before the wordpress jquery?

1.0.0? Really?! Anyway you could try the print_scripts_array filter: // Hack of wp_prototype_before_jquery() in “wp-includes/script-loader.php” function wpse157295_print_scripts_array( $js_array ) { if ( false === $jquery = array_search( ‘jquery-core’, $js_array, true ) ) // Now ‘jquery-core’, not ‘jquery’ return $js_array; $keys = array( ‘jquery.min’, ‘highcharts’, ‘exporting’ ); foreach ( $keys as $key ) { if ( … Read more

Using auth_redirect returns cannot modify header information

It works fine on my localhost as well. The reason it probably doesn’t work on your server is that it’s not using output buffering. Hooking into wp_head means that the page has already started printing to the client’s screen. Meaning auth_redirect‘s use of wp_redirect will fail: the headers have already been sent and you see … Read more

Change dns-prefetch to preconnect for external enqueued resources

There’s a filter, wp_resource_hints, but it only filters each “relation type” (i.e. preconnect, dns-prefetch, etc.) individually, rather than the whole $hints array in your question. However, you could use the filter to empty the array for dns-prefetch and add wp_resource_hints_scripts_styles() to the preconnect array, like this: add_filter( ‘wp_resource_hints’, function( $urls, $relation_type ) { if ( … Read more

append stylesheet via shortcode

here is a handy function i use a lot which is based on the_posts hook function check_for_shortcode($posts) { if ( empty($posts) ) return $posts; $flag = false; foreach ($posts as $post) { if ( stripos($post->post_content, ‘[YOUR_SHORTCODE_HERE’) ) $flag = true; break; } if ($flag){ //add scripts and styles here eg: //wp_enqueue_script //wp_enqueue_style } return $posts; … Read more

How to properly insert a stylesheet in wp_head

You can do it like this, put it in your functions.php : This is the correct way of doing it “the WordPress way”. <?php // Check if function exisits if (!function_exists(‘rg_templateScriptSetup’)) { // if not, create one function rg_templateScriptSetup() { // Register styles in WordPress wp_register_style(‘prefix-basic-css’, get_template_directory_uri(). ‘/css/basic-style.css’); // Register styles in WordPress wp_register_style(‘first-css’, get_template_directory_uri(). … Read more