You could possibly look at doing this the same way that WP Job Manager does:
https://github.com/Automattic/WP-Job-Manager/blob/master/assets/js/ajax-filters.js
This is done by triggering a handler to make the query defining what “page” the query should run against. I would recommend using that as an example to build off of, as it works with both filters applied and none being applied.
ALSO ALWAYS ALWAYS ALWAYS SANITIZE USER DATA
Anywhere you’re using $_POST
$_GET
$_REQUEST
etc you should always sanitize the data before using it anywhere. Best to get in the habit of it or bad things could eventually happen.
https://developer.wordpress.org/themes/theme-security/data-sanitization-escaping/
Related Posts:
- Click loads template via ajax
- How to speed up admin-ajax.php in wordpress
- Ajax request not sending to server and returning – wp-admin/admin-ajax.php 400
- dynamic dependent select dropdown
- How to disable controls in theme customizer?
- Function won’t run onclick using Ajax
- Why i can’t get custom fields value or post ID via Ajax?
- Post not populating for custom post type based on category selection
- How to get post category list as select in front-end?
- Execute Jquery when a specific page in my plugin is loading
- Database entry removed on browser refresh, Ajax PHP jQuery
- Update $wpdb query with AJAX
- How to call a function from functions.php with ajax?
- Custom Post type Ajax search results
- Find the method which AJAX GET calls
- ajax form function error
- AJAX: WordPress filters inside $html do not work as intended
- Can i check if user is doing any ajax request?
- How to use wp_localize_script in a WordPress page other than functions.php?
- Real time Duplicate title check
- Load custom field value into div with AJAX
- Update WordPress Custom Field with AJAX on cached page
- Why does “get_option” pull in the older value in options.php, rather than the newer value, on submission of a form?
- How can I loop into two different DIVS without repeating the DIVs
- Is the regular ajax request method safe or I should use admin-ajax.php?
- Returning a value from a PHP page
- Stumped – Ajax Response Returns 0
- Colorbox ajax loading of outside HTML content works perfect on localhost but not on server
- Use wp_get_recent_posts with search term
- doing an ajax request always outputs 0
- Can’t search posts using WP_QUERY inside AJAX Function
- Woocommerce add to cart quantity buttons with AJAX
- class click counter save number
- AJAX request status 200 but no actual “response”
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- wordpress count link clicks by ip address
- Ajax load more posts with multiple tax query
- WordPress Sending data to Ajax with select option
- PHP 8, AJAX mail form to function.php doesn’t work
- How to prevent WP_Query function from returning all posts when empty?
- Save Search System
- populate form fields in a loop with ajax
- Ajax load more button for comments wordpress
- how to make custom ajax handler?
- Plugins not working on AJAX requests
- How do I Import / Upload Files with jQuery AJAX?
- Unset session variable on page reload / setup but exclude AJAX
- Simple AJAX notification when the new post is added to the database
- jQuery Ajax PHP function call returning [object Object]
- change the default order of posts only for specific categories
- Is there a hack for using is_page() within the function.php file?
- what does $options = get_option(‘test_theme’); do?
- Change Query Arguments (filter) with jQuery/Ajax or PHP?
- How to load previous or next attachment with jquery ?
- Validating an email input from form field before submit using JQuery, AJAX, and PHP
- Execute PHP code only with specific user role
- How to set value selected using select2 jquery plugin
- Disclaimer that will show every refresh of the page
- Tracking Visitor LatLng with WordPress using JS, PHP. How to put data which was extract using JS into DB
- Ajax on the Administration Side of plugin – wp_localize_script – how to pass value from JQuery to PHP function in class?
- WordPress Search Ajax + Isotope + InfiniteScroll
- How do I make these combination select filters work when only one dropdown is set? They work in WordPress 5.8.2 but don’t in 5.8.3
- Failed to load resource: the server responded with a status of 500 (Internal Server Error) through wp_admin_ajax.php
- How to exclude meta no index pages from wp_list_pages
- How to call my PHP function with AJAX ? wp_query
- Outputting post content to jQuery .html() string
- register_block_type is not working properly
- Delete post meta by serialized meta value
- Woocommerce – if selected attribute term equals
- AJAX to add to cart multiple products woocommerce
- wp_set_object_terms returns 500 error when called through AJAX function
- How can i send id of the currently posted form data through json response in custom wordpress plugin?
- Cannot successfully execute AJAX script to call function.php specific function. Using XAMPP localhost to test
- How can i get the same ajax result using WP REST API instead of admin-ajax?
- Remove item from post_meta array via AJAX
- WordPress load javascript file if something… (after the page is loaded)
- defined (‘ABSPATH’) false after AJAX post to other PHP-file
- AJAX Filter WHILE Loop not working WordPress
- WordPress 404 when using AJAX to call php function
- wordpress ajax pagination
- how use php query in AJAX jquery
- Why I’m Not Having Access to “$_POST” Data Outside My AJAX Callback?
- Display Year and Month from custom field + Age Calculator
- Submitting my form to the database and then redirecting to payment site
- insert thumbnail image from php script
- wp_delete_comment is doing nothing
- Weird Behaviour: Not all WordPress Posts appearing
- Pass the updated value of aid from form using ajax
- 500 (Internal Server Error) of external php file
- Use jQuery and AJAX to get HTML
- Dynamic Gallery
- best way to communicate between php and jquery/javascript
- Loading a post’s content, into a div outside the loop, when it’s title is selected in a list
- Jquery autosave text area after typing
- Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
- How to hide .js files on wordpress website using php or wp plugins or any? [closed]
- notify users when changed database
- getJSON response to PHP
- /page/2/ redirect to 404
- Upload multiple files via ajax from an HTML file input