Forum Replies Created

Viewing 15 replies - 1 through 15 (of 101 total)
  • Thread Starter kcaluwae

    (@kcaluwae)

    Using static makes sense as it avoids that there can be multiple instances of the same variable but it gives the same result.

    // No Wordfence captcha check on courses login
    // Global variable to store the captcha requirement
    class My_Wordfence_Captcha_Handler {
    private static $disable_captcha = true;

    public function __construct() {
    add_action('template_redirect', array( $this, 'determine_captcha_requirement' ) );
    add_filter('wordfence_ls_require_captcha', array( $this, 'modify_wordfence_captcha' ) );
    }

    public function determine_captcha_requirement() {
    error_log( 'In determine captcha function' );
    error_log( 'Variable value: ' . var_export( self::$disable_captcha, true ) );
    if ( is_page('courses-login-page') ) {
    self::$disable_captcha = false;
    error_log( 'Wordfence Captcha: Disabled for specific login page' );
    } else {
    self::$disable_captcha = true;
    error_log( 'Wordfence Captcha: NOT disabled for page: ' . get_queried_object()->post_name );
    }
    error_log( 'Variable value at end determine_captcha_requirement function: ' . var_export( self::$disable_captcha, true ) );
    }

    public function modify_wordfence_captcha( $requireCaptcha ) {
    error_log( 'Variable value in wordfence function: ' . var_export( self::$disable_captcha, true ) );
    return self::$disable_captcha;
    }
    }

    new My_Wordfence_Captcha_Handler();

    [03-Oct-2024 18:13:42 UTC] In determine captcha function
    [03-Oct-2024 18:13:42 UTC] Variable value: true
    [03-Oct-2024 18:13:42 UTC] Wordfence Captcha: Disabled for specific login page
    [03-Oct-2024 18:13:42 UTC] Variable value at end determine_captcha_requirement function: false
    [03-Oct-2024 18:13:56 UTC] Variable value in wordfence function: true

    I will have another look tomorrow.

    Thread Starter kcaluwae

    (@kcaluwae)

    @bcworkz Excellent idea, thanks!

    I modified my code and used the template_redirect hook to call my function and set the parameter to false when I’m on the specific page. But for some reason the value is always reset to true by the time the wordfence function is called. This is driving me crazy ??

    This is the code I have. I first tried with a global parameter but modified to code to use a class hoping this would solve the issue but it must be coming from something else.

    // No Wordfence captcha check on courses login
    // Global variable to store the captcha requirement
    class My_Wordfence_Captcha_Handler {
    private $disable_captcha = true;

    public function __construct() {
    add_action('template_redirect', array( $this, 'determine_captcha_requirement' ) );
    add_filter('wordfence_ls_require_captcha', array( $this, 'modify_wordfence_captcha' ) );
    }

    public function determine_captcha_requirement() {
    error_log( 'In determine captcha function' );
    error_log( 'Variable value: ' . var_export( $this->disable_captcha, true ) );
    if ( is_page('courses-login-page') ) {
    $this->disable_captcha = false;
    error_log( 'Wordfence Captcha: Disabled for specific login page' );
    } else {
    $this->disable_captcha = true;
    error_log( 'Wordfence Captcha: NOT disabled for page: ' . get_queried_object()->post_name );
    }
    error_log( 'Variable value at end determine_captcha_requirement function: ' . var_export( $this->disable_captcha, true ) );
    }

    public function modify_wordfence_captcha( $requireCaptcha ) {
    error_log( 'Variable value in wordfence function: ' . var_export( $this->disable_captcha, true ) );
    return $this->disable_captcha;
    }
    }

    new My_Wordfence_Captcha_Handler();

    This is what the log shows:
    If somebody has an idea what could be “resetting” the value in this variable, or where I could look I would appreciate.

    [03-Oct-2024 15:33:23 UTC] In determine captcha function
    [03-Oct-2024 15:33:23 UTC] Variable value: true
    [03-Oct-2024 15:33:23 UTC] Wordfence Captcha: Disabled for specific login page
    [03-Oct-2024 15:33:23 UTC] Variable value at end determine_captcha_requirement function: false
    [03-Oct-2024 15:33:36 UTC] Variable value in wordfence function: true

    Thread Starter kcaluwae

    (@kcaluwae)

    Issue resolved. Apparently an error in one of the pages caused the problems with the cloning of the theme.

    Thread Starter kcaluwae

    (@kcaluwae)

    Hi @addweb-solution-pvt-ltd.
    Thanks for the answer.
    I had tried that approach but instead of choosing the “Custom Template” I always chose “Pages” and then you have to choose a specific page in a next step.

    I completely missed the “Custom Template” at the bottom.

    Thanks!

    Kris

    Thread Starter kcaluwae

    (@kcaluwae)

    Thanks @bcworkz . Good to know.
    I will just start using custom HTML blocks in that case.

    Thread Starter kcaluwae

    (@kcaluwae)

    Thanks, all OK!

    Thread Starter kcaluwae

    (@kcaluwae)

    @gappiah Good point.

    Still, I thought there was a difference since here you can ask the server to process large heavy files, which makes it even easier and faster to overload the server than by just loading a certain page.

    And is there any benefit of leaving this load_scripts.php open to the public? If not, it’s better to close it.

    Thread Starter kcaluwae

    (@kcaluwae)

    OK thanks, I have a staging site, will try it first on that instance.

    Thread Starter kcaluwae

    (@kcaluwae)

    Thanks, I’ve already updated the default. My question was if this implied any risks (see my original question) and if I could run a SQL to update my existing redirects. Thanks!

    Thread Starter kcaluwae

    (@kcaluwae)

    Thanks @johnny5 . Yes the redirect is indeed working as expected.
    As far as I understand Google says it will continue indexing the old post because it sees the new one as a duplicate. They’re indeed exactly the same.
    Would another HTTP code offer another result? It’s a 301, would Google treat a 308 differently? Do you have any insights on that?

    Thread Starter kcaluwae

    (@kcaluwae)

    Sorry for not being more specific.
    We accidentally had a typo in the URL of this post. The original URL was https://www.wapititravel.com/blog/en/what-is-tokyo-know-for/ (missing ‘n’ in known). As the page was already ranking we created a redirect to the proper URL.

    After creating the redirect we got this page indexing issue in the search console.

    Thread Starter kcaluwae

    (@kcaluwae)

    OK thanks!

    Thread Starter kcaluwae

    (@kcaluwae)

    @chouby

    Thanks, I had tried this but I now discovered what I was doing wrong.

    I first went to the categories page clicked on the “+” next to my first category and started entering the name (category B) in the “name” field under “add new category”. This doesn’t work.

    You need to go to the categories page, edit category A and scroll down on the edit page where you can link it to category B in the “translations” section. There the autocomplete is working.

    Thanks!

    Thread Starter kcaluwae

    (@kcaluwae)

    Hi @mrtom414,

    I didn’t really pay attention to which posts I exported. I used the WordPress Import/Export tool and chose ‘Posts’. I suppose it exports the posts table and the relevant meta-tables and filters on posts. Other options are to export pages, fields, …

    To clarify things, this is a function built into the WordPress dashboard, I didn’t do an export in PHPMyAdmin.

    To answer my own question. It’s possible to edit the XML file.
    I changed the category of the posts and also did a search/replace to update the internal links in the posts so they would no longer point to the old domain.

    I think it’s a really efficient way to migrate posts.

    Thread Starter kcaluwae

    (@kcaluwae)

    Hi,

    This is the webstory:
    https://www.wapititravel.com/blog/web-stories/the-perfect-azores-itinerary/

    And here are the figures I see for April:
    Our blog article in analytics : 718 from source (direct)
    Our blog article and webstories featured in discover : 119 click (seen in google search console)
    Story_page_attachment_enter events for the webstory : 158 (seen in analytics property for the webstory)

    158+119 is nowhere close to 718. While I understand that the figures many never really exactly match this difference is big.

    Here are screenshots of the statistics: https://imgur.com/a/ssPJOc9

    Thanks for having a look!

Viewing 15 replies - 1 through 15 (of 101 total)