• Resolved tomcat15

    (@tomcat15)


    Hi
    since updating the plugin about a week ago, “latest version” the human logs has stopped working. While trying different things to find out why I clicked on all the Click to test, click to view etc links and all they did was open the home page in a new window.

    Any suggestions?

    Tom

    https://www.ads-software.com/plugins/wordfence/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author WFMattR

    (@wfmattr)

    Tom,

    The “Click to test…” (etc.) links that you mentioned at the bottom of the Wordfence Options page all use query strings (like yoursite.com/?something). Usually when this shows the site’s home page instead, the theme is loading its templates before plugins have a chance to do their work.

    Can you try temporarily switching to a basic theme like “twentyfifteen”, and see if the links on the Options page work then?

    To fix it, unfortunately, usually the theme author has to make their theme work like a standard theme.

    The logging of human visits partly uses the same method, and has recently had some changes because of the way Google had changed their indexing, and started running scripts the way a human visitor’s browser would. There could be a second problem too — there was another post with an open issue where the script isn’t even showing on their site. If you view the source of a page on your site and serach for “logHuman”, do you find it?

    -Matt R

    Thread Starter tomcat15

    (@tomcat15)

    Hi Matt
    thank you for your reply.
    The issue with the links is theme related after testing.
    The Human visit logging problem I have found on a few of my sites and as you said the script is not shown in the source code. It does show on some sites so I know what it is but not on others.

    Now how to fix this problem?

    Regards Tom

    Plugin Author WFMattR

    (@wfmattr)

    For the missing script — just to confirm, are you using different themes on the sites that show it correctly? Normally it should be loaded by the standard WordPress function, wp_head(), so if the theme author did not include that, they may need to add it to the theme. You might be able to add it yourself if you’re working in a child theme, but it might add other scripts that they were loading through their own method instead.

    You might be able to work around it temporarily, by adding a Wordfence function directly, but you’ll have to keep an eye on it if the theme author does eventually make wp_head() work properly, so that it doesn’t run twice. This should work if it’s inside the <head></head> section:
    <?php if(method_exists('wordfence', 'wfLogHumanHeader') ) { wordfence::wfLogHumanHeader(); } ?>

    (Exclude the php open/close tags, if already working in a section of php, of course.)

    For the problem with the links on the Wordfence Options page, the theme author would need to fix that — it sounds like the theme doesn’t load templates like a typical WordPress theme, so I don’t think there is a way we can work around that. (They can look at a standard WP theme like “twentyfifteen” to see the typical way, if needed.)

    -Matt R

    Thread Starter tomcat15

    (@tomcat15)

    Howdy
    I should have mentioned only one theme has the links not working and script is missing on that one. All my other sites use a variety of themes where the links work but the script is missing on some.
    I have not had a chance to check all just yet.

    The links part does not bother me if it is not part of the cause of the script missing.

    Cheers

    Thread Starter tomcat15

    (@tomcat15)

    Just to add, I put in the code you suggested but not sure if it’s correct? Does not seem to work.

    <head>
    <meta charset=”<?php bloginfo( ‘charset’ );?>”/>
    <meta name=”twitter:widgets:csp” content=”on”>
    <link rel=”profile” href=”https://gmpg.org/xfn/11″/&gt;
    <link rel=”pingback” href=”<?php bloginfo( ‘pingback_url’ ); ?>”/>
    <meta name=”viewport” content=”width=device-width, initial-scale=1, maximum-scale=1″ />
    <?php
    global $post;
    wp_head();?>
    <?php if(method_exists(‘wordfence’, ‘wfLogHumanHeader’) ) { wordfence::wfLogHumanHeader(); } ?>
    </head>

    Plugin Author WFMattR

    (@wfmattr)

    Ok — if the script doesn’t appear when wp_head() is run, and the other line doesn’t do it either, then Wordfence is probably not being loaded properly by the time the header is output. It sounds like the theme might be skipping other normal WordPress hooks, which might cause other parts of Wordfence not to work as well.

    It might be that the theme is preventing the “template_redirect” action from running (this is where Wordfence adds itself to wp_head), or it may just be stopping wp_head from working correctly — or possibly causing some of the hooks to run in a different order than normal, so some objects might not exist when they are needed. I don’t think there is anything else we can do to work around this, so the theme author would likely need to fix the theme so it works more like regular WordPress themes — if they look at template_redirect and wp_head first, they may be able to fix it without too much trouble, but it’s hard to say.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘No humans logged’ is closed to new replies.