Hot answers tagged

1

Did I set up that wp_ajax_nopriv_ hook wrong? No, you did not. But that hook is for logged-out or unregistered users only. For logged-in users, the hook is wp_ajax_<action>. So you just need to change the add_action('get_events' in your code to add_action('wp_ajax_get_events', and the error 400 would be gone: add_action('wp_ajax_get_events', '...


1

There are several membership plugins or customer area plugins. MemberPress is an easy one to setup.


1

As Tom J Nowell noted in the comments, your setup is bit wonky, which is why it won't work. You need to add the ajax actions and register the shortcode earlier - i.e in a custom plugin or in the theme functions.php. This is related to how WordPress handles requests and in which order it loads and does things - the action reference on Codex sheds some light ...


Only top voted, non community-wiki answers of a minimum length are eligible