Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)

You have not added wp_ajax_nopriv so that is the reason for ajax failure for non-logged in users.

public function register() {
    add_action( 'wp_ajax_tidplus' , array( $this, 'post' ) );
    add_action( 'wp_ajax_nopriv_tidplus' , array( $this, 'post' ) );
}

Please do this change and check.

Leave a Comment