The issue turned out to be elsewhere. But I did learn that there is no way to overwrite the queried URL directly, as it comes from $_SERVER variables.
The answer here had some code for anyone who wants to do that:
https://stackoverflow.com/questions/10739721/wordpress-ajax-parse-url
Related Posts:
- Best way to end WordPress ajax request and why?
- Why use wp_send_json() over echo json_encode()?
- How to pass data parameter to ajax action function handler
- Multiple ajax nonce requests
- Update user meta using with ajax
- WordPress function that makes HTML safe to be sent via AJAX request
- admin-ajax.php returns 0. How do I debug it and fix it?
- How to properly use wp.ajax.post?
- AJAX vs Fragment Caching for W3 Total Cache [closed]
- Detecting post type within init action
- Basic question on passing variables to AJAX in WordPress
- Delete row of custom table in WordPress using AJAX
- Change theme based on window size
- Serving nonces through AJAX is not refreshing nonce, returning 403 error
- Cannot update my options using wp_ajax
- Class WP_Rewrite not found
- Prevent wp_debug from polluting ajax within plugin
- How to localize inline script called with ajax
- Conditional Ajax inclusion
- How to allow to user non logged in WP system upload in media library?
- WordPress function to get term or post object by id
- Allow AJAX call to other roles than admin
- submitting form via admin-ajax.php returns 0
- Help add ajax load more button
- Conditional success callback based on Ajax Response not working
- Can a wp_nonce created from domain 1 to be verified on domain 2?
- How to use several wp_ajax_ functions for different queries?
- Three level taxonomy dropdown frontend
- How to solve “Updating failed” with 403 Error when trying to save a Site or Post in Gutenberg?
- Keep getting 400 Bad Request error when trying out AJAX on custom theme
- How to set post_id to 0 when you upload image via Add media button. (async-upload.php)
- Ajax simple experiment
- How to load new text widgets and polls into the sidebar without reloading the page?
- Updating User Meta with Array on Click of Button AJAX
- Why is on status span no search results?
- eventON plugin AJAX call triggers website crash
- Dynamically add more fields/remove last field in a form
- Save & Reset button in theme-option with Ajax (without refresh)
- Ajax Multi Response Problem
- AJAX call inside plugin class not triggering
- Force redirect single.php to index
- Any plugin or Script to integrate ajax selection module into WordPress page
- Custom AJAX Endpoint not returning any result
- Contact form 7 Hide response messages after 5 seconds
- 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?
- How to include php-generated javascript?
- Serve a different theme based on window size
- custom autocomplete search
- post values to custom post type which has advanced custom fields
- ajax problem – function on server is not called
- How to continuously send feedback via AJAX responses to my client?
- get current taxonomy post with ajax
- WordPress Ajax Filter
- Need help with Access-Control-Allow-Origin
- I get a 0 after the result of my ajax requests
- Load page HTML content through AJAX
- Not getting an ajax readystatechange on my page
- problem using ajax url
- Problems implementing Load More functionality
- admin-ajax.php error 500
- How to display contact form 7 form in vanilla js without jquery in frontend
- 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
- jQuery.post returns 0
- Using wp_send_json_success instead of $result[‘message’], die, etc
- do_action won’t work in ajax callback
- Opening Modal popup on Ajax form submission
- Ajax sometimes work and sometimes just don’t work
- admin-ajax error 400
- 400 Bad request while submitting form using AJAX
- wordpress admin ajax trash_comment
- AJAX POST Value not being returned – WordPress – AutoTrader API
- Its possible to ajax update the content of the admin custom post type list
- WordPress custom ajax login not working on mobile browsers
- 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
- how to enable ajax on submitting of contact form 7?
- Create a post with REST API and adding a category
- how to correctly use json_encode with ajax
- How to trigger lost password email using REST API?
- Using AJAX on Contact-form the WordPress way
- Retrieve Header Background Image with AJAX
- How to block search engines indexing certain AJAX actions
- Error while submitting form using AJAX and php
- AJAX call in backend results in empty update_option
- Ajax Comment: Page reloads whenever the comment submission form is reloaded
- How to fetch meta_value and meta_key in matrix after ajax request by post_id
- wp_ajax_action, wp_ajax_nopriv_action not working
- Know which script/page is being called by ajax call
- Can’t update WP Editor after Ajax
- Posting to loop.php file
- Can’t access data from database using AJAX
- how to update pagination after ajax call page 2 show 0
- get_permalink() returns in wrong format via AJAX
- How to add a “Load more” button for the comment section in WordPress?