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
- Why use wp_send_json() over echo json_encode()?
- WordPress AJAX File Upload – FrontEnd
- Uploading Images to Media Library via wp_handle_sideload() fails
- Media not actually deleted on disk when click “Permanent Delete”
- WP 3.5 media manager – how to create a working gallery frame
- Multiple ajax nonce requests
- How to properly use wp.ajax.post?
- Delete row of custom table in WordPress using AJAX
- Create custom tab in WordPress 5 media upload
- Change theme based on window size
- WordPress media upload “HTTP error”
- Class WP_Rewrite not found
- How do I set the url to make an ajax request for a html document?
- Media_handle_upload with custom upload folder?
- wp-admin AJAX with Fetch API is done without user
- Ajax stops working when logged in?
- Populating content dynamically via AJAX and Advanced Custom Fields [closed]
- How do I get allowed Media Library upload file extension list?
- Create Page With wp_insert_post() and AJAX
- How to order images in a post in WordPress 3.3?
- Ajax Check Post Status
- Get wp_title wp ajax
- Allow only attachment uploaded to current post
- Control attachments menu order with jQuery Sortable
- Restrict access of admin uploads to certain logged-in users?
- Speed/Performance difference between `wp_ajax` and `init` checks for AJAX/POST requests?
- How to handle 400 status in Ajax [duplicate]
- WordPress media uploader – upload tabs not hiding
- WordPress ajax works on FF but not on IE & chrome
- Disallow second login session
- Original image not saving?
- Restrict role to view own media
- Ajax call with javascript in post content (not enqueued)
- What’s the latest I can hook into wp_ajax_%?
- Nonce doesn’t validate in nopriv call
- Issue with images which have no sizes available
- How to use ajax to get multiple outputs?
- Admin-ajax.php 400 error in custom theme
- Why does check_ajax_referer give a 403 error on https websites?
- WordPress media upload issue could not insert attachment into the database
- Thumbnail images missing in WP media library
- Hide Load more Ajax button if there is no more users to load or less than the number?
- How to get setting from separate file?
- wp_ajax action is not run when ajax trigger
- Contact form – ajax, wp_mail
- How to change the value “uploaded to” in the media library (WordPress 4.0)
- What if I have a large file on the server that I want the wp library to have?
- Allow users to upload flash videos?
- admin-ajax.php calls fail if referrer is sent with 500
- AJAX not working when clicking load more button, when two terms are present in tax_query
- AJAX – get_posts for a specific post type returns empty
- Admin Ajax always return 0
- Ajax call undefined index
- Is there a hook that fires after an ajax call?
- Dynamic Twitter card images
- error_log() not working within wp_ajax_{action} handler
- Is there a way to add ajax hooks without editing the functions.php file?
- Implement AJAX to fetch pages or posts content in a WordPress custom theme
- Ajax a php file that has Advanced Custom Fields in it
- AJAX is not submitting data to database
- Using AJAX to load div doesn’t always work
- Turn a URL into content preview
- Deploy Subcategories with Ajax not working
- Allow guest to update custom post met using ajax
- Simulate a specific page when making AJAX calls
- How to load post_meta for custom post type via Ajax
- WooCommerce AJAX cross domain add to cart
- Retroactively change Permalinks for media files after disabling year/month format
- Call pre_get_posts inside ajax
- how to update pagination after ajax call page 2 show 0
- How can I add custom sizes for PDF thumbnails generation?
- How to add a “Load more” button for the comment section in WordPress?
- How to show custom fields in modal in category page
- How does the security of admin_ajax.php work?