0

Has anyone here run into this error before? I have a WordPress webpage and I'm trying to load a map (OpenStreetMap) with lots of markers (geojson). It works fine if I'm logged in as admin but it doesn't work when I'm not logged in. It's throwing errors such as: JSON Parse error: Unexpected EOF Error loading settings (undefined is not an object (evaluating 'o.callback')) Error retrieving marker list (undefined is not an object (evaluating 'o.length'))

I think this error has to do with admin-ajax.php being called. My website is hosted on a shred host of Godaddy managed WordPress (with cache/Cloudflare), GoDaddy refused to disable cache because it's a shared host. So I'm looking for a different solution from WordPress community. Hope someone here knows how to fix it. Any suggestion is much appreciated. Thank you! Julian

2
  • Just an idea, but did you added both priv and nopriv actions to the Ajax call? Without more context, it might be you are not doing the action for logged-out users. add_action('wp_ajax_nopriv_test-action', 'test-action'); add_action('wp_ajax_test-action', 'test-action');
    – alex
    May 24 at 13:33
  • Hi Alex, yes indeed. add_action('wp_ajax_mmp_map_markers', array($this, 'map_markers')); add_action('wp_ajax_nopriv_mmp_map_markers', array($this, 'map_markers')); add_action('wp_ajax_mmp_map_geojson', array($this, 'map_geojson')); add_action('wp_ajax_nopriv_mmp_map_geojson', array($this, 'map_geojson')); add_action('wp_ajax_mmp_map_marker_list', array($this, 'map_marker_list')); add_action('wp_ajax_nopriv_mmp_map_marker_list', array($this, 'map_marker_list')); May 25 at 4:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.