Your question specifically asks if wp_is_mobile() is effective; not how device detection should be evaluated. The function just works. So Yes, it is effective. As an example when it may be preferred to client-side detection, even Mozilla thinks that's a bad idea.
It's worth re-iterating: it's very rarely a good idea to use user
agent sniffing. You can almost always find a better, more broadly
compatible way to solve your problem!
mozilla
Is a mobile dectection plugin any better? There may be good reason not to choose mobile detection via a plugin over wp_is_mobile(). First, Wordpress is already doing a lot of the tedius tasks, so just hand this over to it as well!
Prior to loading a DataTable I am using mobile-detect.js as part of my requirement to detect and style when the device is mobile:
// if phone or tablet then set responsive mode
var md = new MobileDetect(window.navigator.userAgent);
if (md.phone() || md.tablet()) {
scrollObj = false;
$('#sometable').removeAttr('width').addClass('dt-responsive');
responsiveObj = {
details: {
type: "inline",
display: $.fn.dataTable.Responsive.display.childRowImmediate
}
};
}
This works fine, but it comes with a small cost to require a plugin for a one time use per session function call. Additionally, it's creator warns about using his plugin.
"you should not use this library in your HTML page and it’s less reliable when used server-side"
So, instead of loading a one-time-use plugin, a more effective way to handle device detection without sniffing is to use wp_is_mobile().
// This is in a JavaScript block in a PHP page
isMobile = Boolean(<?php echo wp_is_mobile() ?>);