First, you do not want to edit core WP files, because your changes will disappear when there’s an update. That’s why you are encouraged to create child themes.
Second, you may want to peruse this Codex page on AJAX. Note that it shows how to handle both kinds of users (logged in and not logged in):
add_action( 'wp_ajax_my_action', 'my_action' );
add_action( 'wp_ajax_nopriv_my_action', 'my_action' );
The my_action
function would go in your theme files (when I was working on mine, I created my own plugin to handle AJAX).
Hope this starts you down the right path.
Related Posts:
- How to set post_id to 0 when you upload image via Add media button. (async-upload.php)
- Distinguish between 2 instances of admin-ajax.php
- Load minimum WordPress environment
- How to hide media uploads by other users in the Media menu?
- admin-ajax.php returns 0. How do I debug it and fix it?
- Add item to media library from blob or dataUrl
- AJAX action not triggering PHP function
- Using wp_handle_upload and media_handle_sideload with ajax
- Force redirect not logged in user to (wp-login.php or wp-admin) for specific page
- How to know what page is calling admin-ajax.php?
- Ajax image upload with media_handle_upload and form.js
- wp_handle_upload returns empty error array
- Pass additional parameter with async upload
- Ajax Request for both logged and non logged users
- WordPress is creating nonce as a logged in user but verifying it incorrectly
- How to disable drag-and-drop upload function in Media Library?
- Why is the file not uploading to the server?
- Filter images from media library by guid meta field
- Frontend AJAX Media Upload returning 404
- How do I set a maximum upload size for a specific user role (Editor)
- How to require files in a custom endpoint
- Cannot add multiple single images at once
- How to send custom variable in Media Uploader ajax request?
- wp_enqueue_media problem
- admin ajax is not working for non logged in users
- AJAX call not initializing for non-admins in WordPress
- SSL breaks customizer: page isn’t returned from ajax
- How to verify nonce from Bulk/Quick Edit in save_post?
- How to implement AJAX post navigation into WordPress?
- wp_ajax_[service] returning 0
- Trying to load content of a post via AJAX
- Insert Post using Ajax
- Ajax function returns -1
- Problems with creating sortable sections in customizer
- 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
- How to make ajax content indexable by search engines?
- Change the size of the image preview on the media edit page
- Uploading images: ‘ø’ get replaced with ‘ø’
- Conditional action hooks
- Changing image URLs in media library
- Buddypress ajax problem after adding new groups sub nav [closed]
- How to check username availability with ajax at registration
- Can a wp_nonce created from domain 1 to be verified on domain 2?
- admin-ajax.php slow, how to speed it up?
- How to use several wp_ajax_ functions for different queries?
- Three level taxonomy dropdown frontend
- I’m getting a 401 while calling the wp-json endpoint via ajax
- Unable to parse JSON response from wp_send_json_success [closed]
- problem with WordPress ajax
- Display attachments by the ID of the post being edited in the wp.media frame (frontend)
- How to make tabulator ajax call in wordpress?
- How would you update a frontend form with AJAX
- Updating User Meta with Array on Click of Button AJAX
- Radio buttons live refresh in the customizer
- Stop auto load wp-admin admin-ajax.php
- wp_enqueue_script() doesn’t work with AJAX
- WordPress Media Library showing wrong preview size?
- Dynamically add more fields/remove last field in a form
- How do I Import / Upload Files with jQuery AJAX?
- WordPress Heartbeat API cannot parse data
- AJAX call broken after actualization
- WP_Ajax Hook doesn’t execute this PHP code
- Ajax function not returning any results
- post values to custom post type which has advanced custom fields
- How to continuously send feedback via AJAX responses to my client?
- Send email via ajax
- Remove Media File Items From Server That Do Not Exist in Media Library
- wp_ajax handler with multiple class instances
- admin-ajax.php (aborted) error when using jQuery.get
- Storing temporary data for a custom post type
- Not getting an ajax readystatechange on my page
- WordPress Select Option Load Custom Fields
- Add ajax to plugin in admin area
- Search live Ajax
- Efficient way to move media folder to another folder
- Ajax login fails: script sets cookies, but is_user_logged_in() returns false
- Using wp_send_json_success instead of $result[‘message’], die, etc
- Ajax call on class returns old data
- delete post meta data in array WordPress
- Display post thumbnail after clicking on post id with AJAX
- Changed media upload path for plugin, but generates error & shows wrong url
- Error while submitting form using AJAX and php
- Organizing the Media Library for Cleanup
- Allow author to upload image via Media button without plugin
- How to fetch meta_value and meta_key in matrix after ajax request by post_id
- Is it a good idea to init ajax functions only while ‘DOING_AJAX’
- Host Images from Link
- register_setting and AJAX?
- Media Library is not loading on grid view in admin panel
- ajax response is 0 instead of ‘script’ [duplicate]
- A refreshless WordPress website
- Dynamic dependent select box getting null value
- get_template_part() does not render after the ajax request
- WordPress Ajax – looping data into a table
- how to update pagination after ajax call page 2 show 0
- get_permalink() returns in wrong format via AJAX
- How can I add custom sizes for PDF thumbnails generation?
- How to add a “Load more” button for the comment section in WordPress?