• Resolved cluster666

    (@cluster666)


    Hello Frank,
    need some help here with a autoptimize_ajax_object error message in my html source output.
    I have disabled the admin-bar function for frontend, perhaps it is related to it …
    Everything works fine and I have a 99% score @ PageSpeed Insights, but how will I get rid of this error message below?

    </script><script type='text/javascript'>
    /* <![CDATA[ */
    var autoptimize_ajax_object = {"ajaxurl":"https:\/\/www.mydomain.tld\/wp-admin\/admin-ajax.php","error_msg":"Your Autoptimize cache might not have been purged successfully, please check on the <a href=https:\/\/www.mydomain.tld\/wp-admin\/options-general.php?page=autoptimize  style=\"white-space:nowrap;\">Autoptimize settings page<\/a>.","dismiss_msg":"Diese Meldung verwerfen.","nonce":"9f72721bbf"};
    /* ]]> */
    </script>

    another ajax calling is placed above which works:

    <script type="text/javascript">
    var bhittani_plugin_kksr_js = {"nonce":"49c147b4d7","grs":true,"ajaxurl":"https:\/\/www.mydomain.tld\/wp-admin\/admin-ajax.php","func":"kksr_ajax","msg":"Rate this post","fuelspeed":400,"thankyou":"Thank you","error_msg":"An error occurred","tooltip":"0","tooltips":[{"tip":"","color":"#ffffff"},{"tip":"","color":"#ffffff"},{"tip":"","color":"#ffffff"},{"tip":"","color":"#ffffff"},{"tip":"","color":"#ffffff"}]};
    </script>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Frank Goossens

    (@futtta)

    well, the fact that there’s an “error_msg” in the ajax-object does not mean there actually is an error, cfr. "error_msg":"An error occurred" in the bhittani_plugin_kksr_js object, it’s just copy that will be shown if the ajax-call is made and the call does not succeed. the autoptimize_ajax_object will, moreover, only be visible for logged in users, so normal visitors won’t see that.

    but if you want, you can prevent autoptimize_ajax_object from appearing in the HTML source on the frontend for everyone by adding this (code-snippet;

    
    add_filter('autoptimize_filter_toolbar_show','not_on_front');
    function not_on_front() {
        if (!is_admin()) {
            return false; 
        } else {
            return true;
        }
    }

    happy lazy sunday! ??
    frank

    Thread Starter cluster666

    (@cluster666)

    OK, I understand … I have not previously checked this for logged in users
    thanks for the filter, it’s working!
    have a nice sunday too

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘autoptimize_ajax_object error message’ is closed to new replies.