• Resolved joeycy

    (@joeycy)


    Hi,

    I would like to ask how can I allow access for the use of /wp-admin/admin-ajax.php together with force login.

    If I’m logged in as subscriber, I’m getting the error:
    SyntaxError: Unexpected token < in JSON at position 0

    I have tried to deactivate force login and the error goes away in Chrome but not firefox.

    I have added these to my functions.php

    add_filter( 'rest_authentication_errors', '__return_true' );
    remove_filter( 'rest_authentication_errors', 'v_forcelogin_rest_access', 99 );

    Could you please guide me to the direction of implementation?

    Thank you!

    • This topic was modified 4 years ago by joeycy.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Kevin Vess

    (@kevinvess)

    Hi, thanks for using Force Login!

    […] I’m getting the error:
    SyntaxError: Unexpected token < in JSON at position 0

    This sounds like a syntax issue with your AJAX code, not Force Login. You’ll need to troubleshoot your code.

    Good luck!

    Thread Starter joeycy

    (@joeycy)

    Hi,

    You are right. I managed to find the error in my AJAX code.

    Thank you so much!

    Plugin Author Kevin Vess

    (@kevinvess)

    Great, I’m glad you got it working!

    Be sure to rate and review my plugin to let others know how you like it.

    Thanks for using Force Login!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Allow access for WP Admin ajax’ is closed to new replies.