Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Forum: Plugins
    In reply to: [Force Login] Wordfence Use
    Thread Starter audept

    (@audept)

    Ok, to help others this is what I did with the rest api code and it seems to be working…if I have done something bad please let me know..?..

    ———————————————————————–

    function v_forcelogin_rest_access( $result ) {
    if ( null === $result && ! is_user_logged_in() ){ $allow = array(“54.68.32.247″,”44.235.211.232″,”54.71.203.174”); //allowed IPs

    if(in_array($_SERVER[‘REMOTE_ADDR’], $allow) || in_array($_SERVER[“HTTP_X_FORWARDED_FOR”], $allow) || in_array($_SERVER[“HTTP_CLIENT_IP”], $allow)) { return $result; }
    return new WP_Error( ‘rest_unauthorized’, __( ‘Only authenticated users can access the REST API.’, ‘wp-force-login’ ), array( ‘status’ => rest_authorization_required_code() ) );
    }
    return $result;

    }
    add_filter( ‘rest_authentication_errors’, ‘v_forcelogin_rest_access’, 99 );
    ————————————————————————-

    Having Added this snippet to the original above….

    { $allow = array(“54.68.32.247″,”44.235.211.232″,”54.71.203.174”); //allowed IPs

    if(in_array($_SERVER[‘REMOTE_ADDR’], $allow) || in_array($_SERVER[“HTTP_X_FORWARDED_FOR”], $allow) || in_array($_SERVER[“HTTP_CLIENT_IP”], $allow)) { return $result; }

    Hi Dave,

    Didn’t understand the history…I knew the display widgets was no longer supported, but it has always been a GREAT plugin. At the time, the extra gelocation code pulled from a remote server still made it worth it to me. Updated 5 sites with the wordpress supported SEO version…no issues, all settings from version 2.04/05 saved…and the new SEO version knew what to do with these.

    Special thanks to you and the wordpress folks for being on top of this ??

    Thread Starter audept

    (@audept)

    Hi displaywidget,

    Confirming viable work-around by save button selection.

    Big relief and Thanks! for your prompt response ??

Viewing 3 replies - 1 through 3 (of 3 total)