I’ve been wondering if EE is actually going anywhere?
I mean, there is not much activity in the discussion area, very little news about the future, and I wonder how a free tool like this can be sustainable for the developers.
Don’t get me wrong, I absolutely love EE for local dev work right now, but there are quite a few worrying bits of advice in the docs/tutorials sections.
For example
This is terrible advice. To point out a few things:
- using $global is extremely inefficient for this type of function, and is totally unnecessary
- using wp_print_scripts is deprecated & should not be used. I mean, this stuff goes back to pre-2010 days, it is antiquated. Use filters!
Same with all of the following, this is just horrible:
- wp_print_footer_scripts
- admin_print_styles
- wp_print_styles
Next:
- the “tutorial” is advising people to use a priority of 999 to force the function to override everything. Terrible practice. Use the proper priorities and avoid conflicts. 15 is usually more than adequate for most custom functions.
Next:
- You should not remove query strings from the admin enqueued scripts and styles. Admin scripts do not affect front end load times, and may be important to allow cache-busting while writing content.
I wonder if the EE developers ever read these posts?
The link above is one example, but there are more.
While I’m tremendously appreciative of the tool, and the fact it is free to use, it would be better to remove bad advice like this and rather pin solutions to questions in the community forum. At least then it would be more current. I mean, that type of coding is over 10 years old!
Example of a better method (other than installing a plugin):
function _remove_script_version( $src ){
$parts = explode( '?ver', $src );
return $parts[0];
}
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );
But now to the final point. Query strings are important!
Google pagespeed tests don’t mean much in this regard. It is bad advice, and a myth that it helps speed up your site.
It also has zero negative effect on your actual SEO.
It’s important to remember that browser caching is happening for each user, on each browser/device they use. You can’t reach into their computer and make them clear their browser cache, and the average person doesn’t do that very often, if ever. So they will be unwittingly stuck with the old, stale, style.css.
Now, if you use a query string to version the filename, you can solve this problem.
So instead of style.css, you have style.css?ver=1
Then you make a change to that file and the filename changes to: style.css?ver=2
The browser sees it is a different file and gets the new version. Boom! Your spiffy new style is available for all to see.
So, having the query string serves an important purpose, and your site will not be faster if you remove it.
Of course there are cases where removing query strings is good, but it is a huge topic, and should not be added as a stale reference in some documentation never to be updated again.
I do hope you are reading this EE devs. You have a great tool here, but it seems to be lacking direction right now.