E: info@davidjlampe.com | T: 608.333.3319

Updated to WordPress 4.5 – Theme fuctions stop working

If you are here, you most likely just updated your WordPress website to the latest version 4.5 and all of a sudden all sorts of things stopped working.

The problem with WordPress 4.5 isn’t that it uses jQuery 1.12.3. The problem is that older versions of jQuery allowed poorly written, malformed, or just plain broken JavaScript to “hide”. In the ever-increasing effort to close security holes and tighten up the running environment of JavaScript, version 1.12.3 will stop running ALL scripts and report an error if something is wrong. So naturally you head to the Googler and what you will find is multiple responses of –

a[href*="#"]:not([href="#"])
Another example would be a[href=#scroll-to-top]
which, when written correctly, should be
a[href="#scroll-to-top"]

Ok, great, what now? First, find the author of your theme and see if there is an update to your theme. Some authors have started including updates to remedy this issue. Next, If your theme is up-to-date and you are still having an issue, go through your plugins one by one and Deactivate them. Then see if the issue has been fixed. If, so, awesome! What you found was a plugin that needs to be updated. Find the author and look for an update.

So you did all that and you still have an issue, now what. One thing you can do is roll back the Jquery version that is loaded. You will need ftp access to make this work, so if you do not have access to your ftp account, contact the administrator or host.

When you are in your FTP client go to wp-includes folder. You will be editing the file script-loader.php.

script-loader

Download this file and save a copy.

jquery

Go to line 182 and change the version to 1.11.3 on line 182 and 183. Save the file replace the file in your ftp.

That’s it! You will now be loading the rolled back version of Jquery. Developers are constantly updating plugins and themes, so they will starting to use the latest version of Jquery. At some point will most likely want to come back and change this to the latest Jquery but for now, your site works like it used to and you arent waiting on an author with a broken site!

Hide WooCommerce “Free” Price Label

Something I have had to work with lately has been how to hide the “Free” price label in the product/category/shop pages. Thanks to WooCommerce’s judicious use of filters/actions, this is very easy request, yet if you’re new to WordPress/WooCommerce you might not necessarily know exactly where to look. Well look no further, because here’s an easy way to suppress that “Free” notice for regular/variable products:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
add_filter( 'woocommerce_variable_free_price_html''hide_free_price_notice' );
add_filter( 'woocommerce_free_price_html',           'hide_free_price_notice' );
add_filter( 'woocommerce_variation_free_price_html', 'hide_free_price_notice' );
/**
 * Hides the 'Free!' price notice
 */
function hide_free_price_notice( $price ) {
  return '';
}

Simply add the above to your theme’s functions.php and you are done.

Upload any file type in WordPress

This tutorial will show you how you can set your WordPress to override the restriction and allow all file types to be uploaded using the media library.

WordPress File Type Restrictions

WordPress by default restricts the file types you can upload using the Media Library Manager. For most of the users this security feature is very good, not allowing publishers to put their server at risk. Read more…