The following code makes several filter functions work on our website, and was written by a former dev. It triggers obnoxious behavior when used with third party js (reloading forms on click, loading errors on calendar functions, etc).
When commented out, it fixes so many problems other problems but breaks our filtering functions. The syntax seems to be a loopy double negative thing.
! function(o) {
function t() {
var t = o("#current-page-id").attr("class");
o("#wp-admin-bar-edit .ab-item").attr("href", window.location.protocol + "//" + window.location.host + "/wp-admin/post.php?post=" + t + "&action=edit"), console.log(window.location.host + "/wp-admin/post.php?post=" + t + "&action=edit")
}
I've attempted to dump it into its own file, then execute it conditionally (only on pages 12 and 16) in functions.php as follows:
function excludetroublescript() {
if(is_page(12,16)) {
wp_enqueue_script('january21-js.js','/assets/js', array('jquery'),'',false);
}
}
add_action('wp-enqueue-script','excludetroublescript');
I find myself needing to code on occasion, but am clearly no engineer. I've given this quite a bit of time. Is there a quick fix that tidies up the original syntax or allows this to be included only on the pages we need it?
Thanks for any clues!