There were three problems I discovered with my code above.
First, $_SERVER["HTTP_REFERRER"];
is an undefined index, moreover it is mispelled – HTTP_REFERER
would be correct if it could be accessed this way in WP. I found get_http_origin()
instead.
$data['UrlReferer'] = get_http_origin();
Second, I also mispelled the field I was saving this variable to – UrlReferrer
(bad), UrlReferer
(correct), something only I could have detected by testing on my end. But I wouldn’t have caught this if I didn’t catch the first.
Third, I dropped $data['ClientBrowser'] = $_SERVER["HTTP_USER_AGENT"];
since I can get that client side.
UPDATE
I can also get the URL referrer from the client side as well, by passing window.location.href
to the api.
Related Posts:
- Rest API User Levels
- remove_action on after_setup_theme not working from child theme
- Remove Actions/Filters added via Anonymous Functions
- Trying to use add_action and do_action with parameters
- Check if post is being published for the first time, or is an already published post being updated
- How to use the do_action () with parameter
- Perform an action when post is updated/published
- WordPress Theme Update Action?
- Extract image from content and set it as the featured image
- Do WordPress’ cron’s clean up expired transients?
- add_action in a function, is it possible?
- Using a private method as an action callback from within a class
- Refresh page after form action
- How to restrict actions and filters “properly” by conditions
- How to count number of functions attached to an action hook?
- Add action hook conditionally – only when home.php in use
- Using add_filter() in Widgets
- How can I tell if I’m on a login page? [duplicate]
- Change meta tags programatically
- Convert hyphen to underscore in permalinks
- Using get_terms for custom taxonomy in functions.php
- Fatal error: Call to undefined function add_action() – an untouched problem
- How to hook into the quick edit action?
- Reuse variable in hook callback
- Call to undefined add_action() in theme’s functions.php
- WooCommerce add_action hook results in 500 error
- Automatically Add Specified Value to Attachment Metadata upon Upload
- Can’t Update function.php after writing short code
- How to update feed only 2-3 times a week (for Feedburner email)?
- creating shortcode to pull json array
- How would go about if I just want a temporary function?
- Passing arguments to my function with do_action and add_action is not working
- Pass parameters to function through an action
- Accepted arguments value in hook functions
- How to select a page within admin?
- How to manage arrays from custom functions stored in functions.php?
- How do I pass arguments for multiple functions hooked to a single action?
- Which action hook to use for function?
- Custom HTML in specific category single page and its descendant categories
- Modify a function without editing template
- Don’t delete a page if it holds users
- How do I add Bootstrap and LESS to my migrated WordPress site?
- Which action does wp_update_user triggers?
- Include default functions and methods
- How can I get my Script to work on the Login page?
- Trigger a custom function when option are saved in admin area
- Output and filter data from a XML url
- Is there an alternative to get_template_directory_uri()?
- How do I find the code executed when wp_head() is called?
- template_redirect action only firing if logged in
- Featured Image and Tags problem
- How to use wp_enqueue_script properly?
- Using get_terms for custom taxonomy in functions.php
- Issue passing action class to nested function. Admin Columns
- Does hook have an effect on increasing the page load?
- How to Override Page Template if URL matches query?
- Save_post – Warning: Cannot modify header information
- What is the earliest Hook a Script can use?
- How do I trigger WP CLI DB export using a PHP function?
- If has action not working as expected
- Modifying a WordPress Plugin
- post value to function with Ajax and jQuery
- When are the user meta fields created in the database? Admin vs Woo API REST
- Is_Page doesnt detect my page
- How do you insert code into the sidebar?
- How Do I Unhook This Parent Theme Function?
- How to show only specific category post by user role without plugin and restrict all other cats
- Postback redirect through add_action is not triggered
- use add_action in a shortcode (gravity form – WordPress)
- wp_footer hook causing text to show on bottom of page
- Remove action hook from Class, understanding OOP
- How to change form action of wp-login page with a function
- Is it possible to use ‘wp_insert_post’ function within a for loop?
- Which method is more correct for removing WooCommerce Extensions menu item?
- MCAPI.class.php showing some error
- WordPress hooks to call a function inside a construct
- True parameter but jquery register in header and not in the footer with wp_register_script
- Fatal error: Call to undefined function add_action() – an untouched problem
- Sending Messages Back to the Template After Processing?
- Pass arguments to function class with do_action()
- previous_post_link inside of a function?
- custom COOKIE on custom page
- What add_action reference should I be using or should I use do_action?
- Getting error while trying to use custom comment function
- Settings in functions.php used by a plugin
- function to return comma separated list of meta values
- Do something when user creates post (that’s pending)
- Integrating custom API for post content into Admin interface & Public Website [closed]
- add variable to actions/functions across different files (woocommerce)
- HELP: Code To Check Status And Write Debug Entry
- delete_term is not working properly with add_action()
- Timeline from diferent wordpress api urls endpoint works, but diferent date
- How to get variable from other function inside class function using add_action for Ajax call
- Function attached to cron job not running but will run if called manually
- Submit CF7 form programmatically with WP-Cron?
- disable a specefic sidebar when user is log out
- wp_update_post breaks my function
- is there a list of actions on WordPress
- Remove Actions/Filters added via Anonymous Functions
- How to redirect using a custom wordpress api endpoint after form submission?