Problem with WP 4.5
-
If plugin is active then Add Media in editor dont’t work.
-
Yep, headspace is causing JS errors on WP 4.5:
$( 'a[href=#toggle]' ).click( function(){
triggers:
Syntax error, unrecognized expression: a[href=#toggle]
Stops media uploads, screen options and tagging.
For my site, it’s breaking anywhere I’m using Advanced Custom Fields on the admin. Confirmed this is an issue as found the following lines of code.
wp-content/plugins/headspace2/js/headspace.js 26: $( 'a[href=#toggle]' ).click( function(){ 61: $( 'a[href=#toggle]' ).click( function(){
And that is the issue outlined here: https://www.ads-software.com/support/topic/read-this-first-wordpress-45-master-list?replies=7
WordPress includes the latest version of jQuery 1.12, which was released back in January: https://blog.jquery.com/2016/01/08/jquery-2-2-and-1-12-released/
It has been discovered that old versions of jQuery worked with an incorrect syntax. That bug was one amongst many bugs fixed in jQuery 1.12. The symptom of this problem is the following message (or something very similar) in the Javascript console when viewing the site in a browser:
Uncaught Error: Syntax error, unrecognized expression: a[href*=#]:not([href=#])
This is a bit of code that is in somewhat common usage. The problem is that it is incorrect. The link location (hash marks, #, in this case) should be quoted: a[href*=”#”]:not([href=”#”])
Another example would be a[href=#scroll-to-top] which, when written correctly, should be a[href=”#scroll-to-top”]
This can happen in other ways too, this is just one commonplace example. The signs that distinguish this problem are the href and the hash mark (#).
So, what a lot of people are finding out now is that a whole lot of Javascript code out there was doing-it-wrong all this time, and they never noticed because jQuery incorrectly worked with that particular style of broken code. Once WordPress upgraded, and people got the new jQuery, people are now seeing those bugs in their own code.
All that broken Javascript code will need to be fixed. Fortunately, it’s a pretty simple fix, but in the meantime, it’s still broken.
The best advice we can give you is to update all your plugins and themes to the latest versions by their vendors. Plugin and theme authors should be looking to the JS libraries they use for fixes, and including those newer versions of the affected libraries in their code.
This is exactly the problem I’m facing. I updated all the plugins (at least those that could be updated!) – but still the problem persists. What’s the solution please?
If your problem is related with headspace, then go to:
wp-content/plugins/headspace2/js/headspace.jsLine 26:
Change: $( ‘a[href=#toggle]’ ).click( function(){
With: $( ‘a[href=”#toggle”]’ ).click( function(){Line 61:
Change: $( ‘a[href=#toggle]’ ).click( function(){
With: $( ‘a[href=”#toggle”]’ ).click( function(){Jacob has the winning post.
The only change is in two places to put double quotes around #toggle in /js/headspace.js, as noted lines 26 and 61, but a search and replace would find them easily.
That’s it, works great again. Maybe time to fork this plugin so that we don’t have to keep hacking edits. This and the Goodey’s redirection plugin (https://www.ads-software.com/plugins/redirection/) are really important, and just need a bit of maintenance every so often.
Bless you for this. Fixed! I have eight years worth of SEO built into my posts with this plugin.
I solved the problem by replacing a plugin on Yoast SEO. I wrote a post “Hot to import meta-data from HeadSpace2 to Yoast SEO” – https://onedev.net/post/709
And
page-settings-edit.php
Line 19
Change:<a href="#toggle"><?php _e ('advanced', 'headspace'); ?></a>
With:<a href="#toggle" id="hs-toggle"><?php _e ('advanced', 'headspace'); ?></a>
Thank you blog
https://irec.jp/wordpress/wordpress4-5-headspace2/@jacob – the hero here.
His fix worked.
I lost half a day trying to figure out this before I realized it was the plugin.If would be great it some one forked this.
I’ve used Yoast and All-in One but they are too bulky, too many options. I like Headspace2 because it cuts to the chase and does the SEO essentials well.I just spent a few hours looking around for good replacements for Headspace2.
I like Greg’s High Performance SEO https://www.ads-software.com/plugins/gregs-high-performance-seo/
also Add Meta Tags looks like a good replacement for headspace2 , though a little geeky in it’s assumption of tech language. https://www.ads-software.com/plugins/add-meta-tags/
There is also a converter which promises to convert your Headspace2 data to the other plugins (works with the two above mentioned plugins.) :
SEO Data Transporter: https://www.ads-software.com/plugins/seo-data-transporter/ I used this to convert a site with about 20 pages and as many posts that used Headspace2. Converted to Greg’s HP SEO and it seems like it worked.I don’t work for any of the above plugins, just though it might help the other folks finding who stumbled upon this post in their attempts to fi their headspace2-4.5 compatibility issue.
-cheers,
GMI confirm that Torikumo’s change was needed too, at least in my case, where Jacob’s changes were not sufficient.
Many thanks!
Michael.I want to get a new version of Headspace into the plugins library, but the WordPress plugin folks require a lot more refactoring/security changes before they will let it in.
In the meantime, I’ve put my version (bugfixes only, no features/refactoring) up on Github. Feel free to contribute, add or comment on Issues, etc. I’ve been using Headspace for years and years and see nothing that has the simple and clean functionality.
Hi @johnny5, are you in a position to comment on this and whether a minor Plugin release will be announced to resolve this jQuery issue?
- The topic ‘Problem with WP 4.5’ is closed to new replies.