On line 252 you are using print_r()
inside your code, which is printing out an error message before the proper response, so your response is not valid JSON anymore.
If, as it appears, you want to include the output of print_r()
in your error log, and not include it in the response, you need to set the second argument so that the value of print_r()
is returned, and not printed:
error_log( "get_detail =" . print_r( $data, true ) );
Related Posts:
- How to: Rest endpoint returning empty object
- get all products of one category
- How can I pass get_the_author_meta(‘user_email’) through the REST API?
- Create a new post using rest api and save featured image using an external image url
- How to do admin ajax request in a plugin for rest api
- ajax response strips multidimensional array and unable to decode
- Is it possible to make WordPress as a RESTful app?
- oneOf two possible objects in WP REST API?
- No Error Log File, no debug info
- How should one implement add_settings_error on custom menu pages?
- How can I run AJAX on a button click event?
- Prevent notice and warnings in error_reporting?
- What is nonce and how to use it with Ajax in WordPress? [duplicate]
- Empty POST data on server on AJAX request using Angular $http
- Catch own Exceptions
- Using AJAX in a plugin to submit form – REALLY confused
- wp_localize_script $handle
- Custom endpoint that returns an xml
- How to post form in ajax mode and handle it in wordpress
- Using Ajax call in jQuery doesn’t work in widget
- Display sub-taxonomies based on SELECTED parent-taxonomy
- WP rest api v2 posts filter by ‘search’ & ‘category_name’ not working
- Error : “Updating failed: The response is not a valid JSON response” with custom shortcode
- How can I display an error message after post has been saved?
- What method to use to call a REST API?
- Execution limit and Memory limit errors even i changed to 1024M and 600(cache.php,load.php)?
- Ajax in WordPress – path issue
- Cannot search post by taxonomy
- WP AJAX is not working, always returns 0
- Two functions utilizing registration_errors filter
- Slow WP_query due to nested wp_query. Need Suggestions
- How to get results of subcategories also?(WP Rest Api v2)
- Woocommerce checkout update totals with datepicker
- Including the necessary functions for a custom ajax registration form
- How can I rewrite a URL to pass requests to a custom method via AJAX? (I can’t use admin-ajax.php)
- Dashboard – get status and position of metaboxes and pass them to ajax method
- Amending REST API function without deactivate/activate plugin every time changes is made
- Storing data in wordpress database from ajax call from different website
- Secure REST with nonce works only when not logged
- Create custom HTML/JS app inside page
- wordpress JSONAPI introspector always limits number at 10?
- wp_localize_script is not adding a global variable for javascript
- json_decode does not work on WordPress
- wordpress is adding a second backslash when I use addslashes
- Remove entire [$key] from array stored in custom field using Ajax – unset($array[$key]); not working
- Ajax is not working in a loop
- How to get error object returned by wp_create_user
- Can’t retrieve body params from PUT endpoint using formdata
- Do I need to create an endpoint?
- How to use apiFetch to get author information in Gutenberg properly?
- How do I get rid of my inclusion race-condition on wp_enqueue_script
- Issues Updating Post Meta with AJAX (Seems simple but cannot figure it out)
- Mock a dependency of a WP_REST_Controller class
- ajax working when function is on child theme but not in plugin page
- AJAX call to admin-ajax.php by subscriber returns home page
- Custom Post Type Object – Undefined Variables
- Ajax function is not working on WordPress
- About a programming language starts with [closed]
- Plugin Development: Storing and Manipulating Data That Fits JSON in Database
- Workflow for new importer plugin – your advices?
- How do I debug an error that a plugin is causing?
- “Rendering of admin template [path to template] failed”
- Allow REST API Endpoint to specific user and hide from public
- Ajax on the Administration Side of plugin – returns 0
- wc_get_template_part doesnt display the content [duplicate]
- Ajax action has 200 status but response of No response data available for this request
- Query String Filtering API
- Bad request 400 using class based files
- Get Custom taxonomy parent with wordpress REST API
- register_meta not showing custom post type metabox data in rest api
- Trying to run a Ajax request from a checkout form in woocommerce via a custom plugin
- Securing custom rest API endpoints with public access from PWA
- WP_Query not ordering correctly
- 403 error rest_’cookie_invalid_nonce’ on API Request
- How to use Datatable with Ajax when creating plugin on WordPress?
- 400 Bad Request and illegal invocation in wp_ajax based on processData set to false or true
- Rate limiting ajax requests in WordPress
- ajax-action.php can’t find added action
- WC REST API Error Handling
- AJAX call of function containing javascript which is not loaded (Plugin development)
- How to include files in the loop via ajax
- How to handle ajax Request in a complex-structured plugin?
- wp_ajax add_action fuction won’t fire on custom jQuery action
- Filterable posts using categories
- Ajax Response Error | just getting error as the response
- React in plugins: REST endpoints vs. regular functions
- PHP includes with AJAX actions
- admin-ajax.php returns “No Script Kiddies!” sometimes
- WordPress function is not called and ajax return 0
- WP API users per page
- WordPress plugin: admin-ajax.php not passing data to custom function
- Is it safe to use PUT and DELETE requests
- Page reload occurs before request finishes
- PHPUnit Ajax Serialization of ‘Closure’ is not allowed
- How can I send api calls from my plugin?
- Return custom product in ajax call loop
- How can create a custom plugin to call my webapi after any registration or membership plugin functionality
- Rest Api WordPress
- Programmatically creating posts based on external JSON feed (asynchronously)
- Does WP REST API cache internally executed (rest_do_request) requests?