I think this is just a slight mistake on your “if” condition
$result = preg_split('/\//','domain.com/api/user/verify_phone');
var_dump($result);
Results in:
array(4) {
[0]=>
string(10) "domain.com"
[1]=>
string(3) "api"
[2]=>
string(4) "user"
[3]=>
string(12) "verify_phone"
}
So the result at [1] is “api”, but you are checking for “/api/” on the fourth line of your code sample.
Related Posts:
- Is there a JavaScript API? How to access public and private data in JS?
- AJAX request from Chrome Extension to WordPress Website
- fetching via fetch/ajax gutenberg block data from third party
- wp_localize_script escaping my url – fix or alternative
- Most performant way of fetching remote API data?
- How to add WP API and JS featured image attachment
- Implementing an AJAX POST API call in wordpress
- I have to post data by AJAX in wordpress to another Website
- Exposing data using a custom WordPress API
- Use WP admin AJAX url to hide API key
- How to submit a button automatically after every scheduled hours?
- Google Maps API throws “Uncaught ReferenceError: google is not defined” only when using AJAX
- Initialize TinyMCE editor / visual editor after AJAX insert
- Using Ajax with a Class file
- 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?
- Stop admin-ajax?
- Is it safe to assume that a nonce may be validated more than once?
- Using Nonces for AJAX that only retrieves data
- WP set auth cookie using Ajax is not saved to browser
- store/cache ajax sent data to avoid repeated request
- Trying to load content of a post via AJAX
- Insert Post using Ajax
- How can I automatically login using a URL?
- Run again current query via ajax but changing a var
- Quick Edit: Selected Custom Taxonomy Not Refreshing After Save
- wp_verify_nonce always returns false when logged in as admin
- Ajax requests with different WordPress Address and Site Address setup
- is_home doesn’t affect content
- How to make get_theme_mod work with AJAX in the customizer preview
- How to check an ajax nonce in PHP
- jQuery Ajax passing empty parameters to my function?
- admin-ajax.php slows down, but cant figure out which plugin
- Convert this relative path to absolute
- Load WP content with ajax less server demanding and faster than normal page loading?
- admin-ajax.php slow website, how to fix
- WP Admin AJAX Security – using POST to include a relative URL
- Admin-ajax.php 400 error
- wp_create_nonce() in REST API makes user->ID zero
- How to create an ajax endpoint without js?
- AJAX Load more on CPT returning random posts
- WordPress admin-ajax.php not available for subscribers/contributors
- WP Ajax never returning any data / calling action
- get_queried_object_id in AJAX
- Should I check for privileges before hooking into `wp_ajax_$handle` or after?
- Refresh Markercluster after ajax call
- Making an ajax request from a different domain
- Mapping Backbone Models to serialized array in wp_options table
- Images loading over http instead of https
- Ajax login without redirect/reload
- wp_mail 200 response but no mail sent
- Is it secure to use admin-ajax.php in front?
- Best way to use ajax front-end?
- Ajax calls from the theme directory
- How to pass parameters from jQuery ajax into PHP function?
- ajax is returning 0
- How to add ajax url to js using wp_add_inline_script()?
- merge wp rest api query to get posts per category does not work
- use jQuery.load() to include a php file in a div, wp_query() is part of php file
- WP AJAX post filter > do something with empty value
- Send checkbox status with Ajax / JSON and save it
- ajax refresh to display new posts
- wp ajax execution time aborted 30 sec
- How to get setting from separate file?
- WordPress function not defined in AJAX call
- admin-ajax.php calls fail if referrer is sent with 500
- Fetch value using AJAX in WordPress
- Can I use application/json content type in WordPress
- AJAX – get_posts for a specific post type returns empty
- What is the relationship between UFW (firewall) being enabled and cron job running?
- WPBakery post content inside Bootstrap Modal
- Hook after all metadata are set is triggering several time
- check_ajax_reffer not working when logged
- Assign author on ajax wp post insert
- Ajax a php file that has Advanced Custom Fields in it
- Ajax show custom post data form & script
- Portfolio list view after clicking back button
- How to use add_action(‘wp_ajax_[action name]’,…) for a specific page with condition?
- Display SOLDOUT text in Dropdowns of Variable Product in WooCommerce [closed]
- Using AJAX to load div doesn’t always work
- Turn a URL into content preview
- AJAX save options inside class
- How to test if in dashboard, bypassing Ajax quirk
- Simulate a specific page when making AJAX calls
- Usage of wp_send_json_success and wp_redirect at the same time
- How to load post_meta for custom post type via Ajax
- Can I make an ajax response cross-domain?
- Load more posts with Ajax and masonry
- Caching for logged in user and Ajax update
- update_user_meta updates to a wrong ID
- WordPress sound bell when new data will add
- Disable Ajax for Spiders
- what’s the way to access variables from serializeArray
- WooCommerce AJAX cross domain add to cart
- Can a scrollable date picker be done in WordPress for archives?
- get_permalink() returns in wrong format via AJAX
- Logout and redirect WordPress user id without he refresh the page
- How to show custom fields in modal in category page
- No full page reload when navigating from page A to page B: is this possible with WordPress?