For non-admin users to be able to use an ajax function, you need to also include a second hook using wp_ajax_nopriv
So right after this:
add_action('wp_ajax_add_category_bookly', 'add_category_bookly_callback');
you should include this:
add_action('wp_ajax_nopriv_add_category_bookly', 'add_category_bookly_callback');
Related Posts:
- Issue with front-end ajax, getting a 302 redirect when accessing wp-admin/admin-ajax.php
- Ajax Redirect role = ‘Editor’ to their Dashboard after register
- Allow AJAX call to other roles than admin
- Adding user using admin ajax by a user with custom role
- Ajax call not working anymore
- Front-end ajax problem all users and guests getting a 302 redirect when accessing wp-admin/admin-ajax.php
- Google Maps API throws “Uncaught ReferenceError: google is not defined” only when using AJAX
- Initialize TinyMCE editor / visual editor after AJAX insert
- Displaying PHP Errors from admin-ajax.php
- wp_set_auth_cookie() doesn’t work in Ajax call
- WP-AJAX vs WP REST API: What to use for requests to the website from outside?
- SSL breaks customizer: page isn’t returned from ajax
- Is it safe to assume that a nonce may be validated more than once?
- Using Nonces for AJAX that only retrieves data
- How to verify nonce from Bulk/Quick Edit in save_post?
- How to implement AJAX post navigation into WordPress?
- wp_ajax_[service] returning 0
- Ajax function returns -1
- Problems with creating sortable sections in customizer
- Quick Edit: Selected Custom Taxonomy Not Refreshing After Save
- Is it OK to use a system cron to trigger a function hooked into the AJAX API
- Filter WP user acf field by ajax
- Ajax Request not coming back to class
- wp_verify_nonce always returns false when logged in as admin
- fetching via fetch/ajax gutenberg block data from third party
- ajax and nonce when JavaScript is in a seperate file
- Class WP_Rewrite not found
- How to allow to user non logged in WP system upload in media library?
- WordPress function to get term or post object by id
- Buddypress ajax problem after adding new groups sub nav [closed]
- How to check username availability with ajax at registration
- Conditional success callback based on Ajax Response not working
- admin-ajax.php slow, how to speed it up?
- I’m getting a 401 while calling the wp-json endpoint via ajax
- Unable to parse JSON response from wp_send_json_success [closed]
- Keep getting 400 Bad Request error when trying out AJAX on custom theme
- problem with WordPress ajax
- Ajax simple experiment
- How to load new text widgets and polls into the sidebar without reloading the page?
- How to make tabulator ajax call in wordpress?
- How would you update a frontend form with AJAX
- Radio buttons live refresh in the customizer
- Admin ajax add tag callback
- Stop auto load wp-admin admin-ajax.php
- wp_enqueue_script() doesn’t work with AJAX
- Save & Reset button in theme-option with Ajax (without refresh)
- Ajax Request for both logged and non logged users
- Ajax Multi Response Problem
- AJAX call inside plugin class not triggering
- Custom AJAX Endpoint not returning any result
- Contact form 7 Hide response messages after 5 seconds
- WordPress Heartbeat API cannot parse data
- how should i get json encoded data from wordpress ajax action page
- Cache plugins and ajax nonce verification
- Ajax function on #publish only saves as draft – how to make it publish?
- AJAX call broken after actualization
- WP_Ajax Hook doesn’t execute this PHP code
- Ajax function not returning any results
- ajax problem – function on server is not called
- wp_mail doesn’t work when logged in?
- Need help with Access-Control-Allow-Origin
- Send email via ajax
- wp_ajax handler with multiple class instances
- admin-ajax.php (aborted) error when using jQuery.get
- Storing temporary data for a custom post type
- Load page HTML content through AJAX
- Not getting an ajax readystatechange on my page
- Error sending array data from php to javascript
- Sharing variables in both actions wp_footer and wp_ajax
- Display full WordPress post under search form using AJAX
- Ajax callback not work
- WordPress Select Option Load Custom Fields
- Add ajax to plugin in admin area
- Search live Ajax
- jQuery.post returns 0
- Ajax login fails: script sets cookies, but is_user_logged_in() returns false
- Opening Modal popup on Ajax form submission
- Ajax sometimes work and sometimes just don’t work
- admin-ajax error 400
- wordpress admin ajax trash_comment
- Failed to load resource: the server responded with a status of 404 (Not Found) admin-ajax.php
- Javascript output now showing in custom widget
- Ajax call on class returns old data
- Create a post with REST API and adding a category
- how to correctly use json_encode with ajax
- delete post meta data in array WordPress
- How to trigger lost password email using REST API?
- Display post thumbnail after clicking on post id with AJAX
- How to block search engines indexing certain AJAX actions
- Error while submitting form using AJAX and php
- wp_ajax_action, wp_ajax_nopriv_action not working
- Manually cache a special, non-WP-but-using-WP page (e.g. Ajax results) with W3TC
- Is it a good idea to init ajax functions only while ‘DOING_AJAX’
- register_setting and AJAX?
- Static var overwritten with WP AJAX action, works fine without AJAX
- ajax response is 0 instead of ‘script’ [duplicate]
- using ajax to query sql
- A refreshless WordPress website
- get_template_part() does not render after the ajax request
- Run PHPMailer function after ajax function completes that adds row to custom table