• Hey, trying to figure out what this script is that is showing up in wp_footer. Is this normal WP stuff? Can I remove it? I don’t think it is being used.

    <script type="text/javascript">
            jQuery(document).ready(function ($) {
                //$( document ).ajaxStart(function() {
                //});
    
    			
                for (var i = 0; i < document.forms.length; ++i) {
                    var form = document.forms[i];
    				if ($(form).attr("method") != "get") { $(form).append('<input type="hidden" name="QFSCLTy" value="Fm@REVn" />'); }
    if ($(form).attr("method") != "get") { $(form).append('<input type="hidden" name="VXHSeh" value="QuPV0H" />'); }
                }
    
    			
                $(document).on('submit', 'form', function () {
    				if ($(this).attr("method") != "get") { $(this).append('<input type="hidden" name="QFSCLTy" value="Fm@REVn" />'); }
    if ($(this).attr("method") != "get") { $(this).append('<input type="hidden" name="VXHSeh" value="QuPV0H" />'); }
                    return true;
                });
    
    			
                jQuery.ajaxSetup({
                    beforeSend: function (e, data) {
    
                        //console.log(Object.getOwnPropertyNames(data).sort());
                        //console.log(data.type);
    
                        if (data.type !== 'POST') return;
    
                        if (typeof data.data === 'object' && data.data !== null) {
    						data.data.append("QFSCLTy", "Fm@REVn");
    data.data.append("VXHSeh", "QuPV0H");
                        }
                        else {
                            data.data =  data.data + '&QFSCLTy=Fm@REVn&VXHSeh=QuPV0H';
                        }
                    }
                });
    
            });
    	</script>
    • This topic was modified 5 years, 3 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not a Developing with WordPress topic
Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator bcworkz

    (@bcworkz)

    It’s not part of core WP. It could be part of your theme or a plugin. It appears to be adding some sort of tracking data to any form submittal. Depending on where the form is submitted, it could be meaningful, otherwise it’s ignored.

    Try converting it to an HTML comment with <!-- script>...</script --> to disable the script and test various form submittals on your site and see if anything breaks. If it does, it’s easily restored. Otherwise it’s probably safe to delete.

    IMO, because it’s blindly adding data to any form, I think it’s either very poorly written or nefariously tracking something. But I don’t have enough information to say for sure.

    Are you talking about the footer.php file in your theme folder, or the wp_footer() core function, or something else?

    Could you please clarify where you’re finding this code?

    Thread Starter wyclef

    (@wyclef)

    Talking about whatever <?php wp_footer(); ?> calls. Not footer.php. I can try and comment it out, probably would take weeks or months for the client to complain about something not working for me to figure out what is has to do with if anything.

    • This reply was modified 5 years, 3 months ago by wyclef.
    Moderator bcworkz

    (@bcworkz)

    It invokes the “wp_footer” action which could in part be the source of the questionable code. It could also be the source of desirable content. It’s normal call in WP themes. You could try commenting it out and see what disappears. But if you add other plugins in the future, they may fail to work properly without this call being active.

    It’d be better to find code that is hooked into this action. Try deactivating all plugins and switch your theme to a twenty* default theme. You’ll see that the questionable script is gone. Restore your theme, then the plugins, one at a time, checking for the code after each activation. When the script reappears, the last activated module is the source.

    Use a command line tool like grep or findstr to search all .php files in that module’s folder for “wp_footer”. Among the search hits should be code similar to
    add_action('wp_footer', 'some_function');
    You may want to download the module’s source code to your local computer to make searching easier, since many hosting accounts don’t offer terminal access. Read your tool of choice’s documentation to learn the appropriate syntax and flags to set to search recursively in all .php files in the module’s folder and display every matching file name and line of code.

    Search again for “function some_function” or whatever name occurs in the found add_action code. The function declaration so found could be the source of the questionable code. Or it could be something you need. This could be a tedious process, but it’s your best chance of stopping the script at its source without compromising your site’s functionality.

    Thread Starter wyclef

    (@wyclef)

    So far I’ve just commented it out. Will kind of just give it some time to see if anything breaks. Can’t put a lot into this one at this time.

    Thread Starter wyclef

    (@wyclef)

    Hey, commenting out <?php wp_footer(); ?> makes it so the admin bar isn’t visible in when logged into admin area and visiting site. Is this normal?

    Moderator bcworkz

    (@bcworkz)

    Yes, all the content for admin bar is injected by a call to wp_footer().

    I did say “It could also be the source of desirable content.” ??
    Slipped my mind that it included the admin bar.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘What is this script in wp_footer? Can I remove it and how?’ is closed to new replies.