because you don’t return JSON, you can use admin-post.php
.
create a hook like that :
add_action("admin_post_nopriv_MY_PLUGIN__answer", function () {
header("Content-type: text/xml");
echo "<abc><def>1</def></abc>";
exit();
});
and then use the url /wp-admin/admin-post.php?action=MY_PLUGIN__answer
.
when you do debugging, don’t forget that admin_post_nopriv
only answers on unconnected users then you can open the url in another browser.
Related Posts:
- Amending REST API function without deactivate/activate plugin every time changes is made
- Adding custom end points, No error line
- Allow REST API Endpoint to specific user and hide from public
- Custom Endpoint – Does it possible to use PUT method with WP API Rest?
- How to query a nested field in wordpress api using _fields param
- Adding Amchart Interface to WordPress API
- Multisite and the JSON REST API: How to?
- How to update WordPress Plugins in your own maintance application?
- External api call using wordpress
- Can’t save Image from external API into Database
- How can you check if you are in a particular page in the WP Admin section? For example how can I check if I am in the Users > Your Profile page?
- How to create an API for my plugin?
- How to store username and password to API in wordpress option DB?
- Is there a limit on making calls to WordPress.org API’s?
- How to check WordPress website username and password is correct
- WordPress REST API call generates nonce twice on every call
- permalinks with get variables
- How to: Rest endpoint returning empty object
- Plugin Sidebar is not Saving Meta Attribute to Post/Page after “Update”
- Rest Api How to get results of child categories with one api call
- Build dynamic page from cURL (HTML page) response with plugin
- wp_enqueue_style built in styles
- REST-API: extend media-endpoint
- How to duplicate a curl XML request using HTTP API?
- Should I ask my Twitter plugin users to create their own Twitter App and API Keys to use my plugin?
- What method to use to call a REST API?
- $wpdb -> Batch insert from XML File?
- How to sanitize user input?
- Should I always prefer esc_attr_e & esc_html_e instead of _e?
- WP REST API V2 – Add user data to response
- How to get results of subcategories also?(WP Rest Api v2)
- WP_Editor – Saving Value into Plugin Option – Stripping HTML
- Using WPDB to output raw XML fails because of wp-blog-header.php
- Failed to Open Stream: Permission Denied While Writing to an XML File in a WordPress Plugin
- Create a new post using rest api and save featured image using an external image url
- Why does wp_remote_post returns an empty body response on certain endpoints?
- How to modify WCMP Rest API response?
- Sending post request with wp_remote_post not working correctly
- wp_remote_get() returns 403 while file_get_contents() does not
- Serve text/html from wp-json API via WPEngine, headers not being set properly
- woocommerce_checkout_order_processed hook executing function twice
- How to do POST request with WP REST API v2 to custom table?
- mysql_real_escape_string() vs. esc_sql() in WordPress
- What to hook into to check a value before a post is published?
- rest_no_route on custom API endpoint wordpress
- Custom Rest Endpoint: Post/Put/Patch not working
- Encoding Method for URLs?
- Why would you use esc_attr() on internal functions?
- WordPress Rest API with rest_do_request, possible race condition?
- Mock a dependency of a WP_REST_Controller class
- update_callback is not working in register_rest_field
- Plugin index page code executes multiple times
- REST Endpoint API 404
- Pass CF7 form data to plugin
- Plugin architecture to pull from API & create dynamic content on WP site?
- Lead form that submits to 2 external APIs
- How to do admin ajax request in a plugin for rest api
- Attaching Image-file to userId
- Get API auth_token token to renew weekly
- escape html in jQuery for WordPress
- Query String Filtering API
- Custom plugin & calling REST api of wordpress instance the plugins is running on
- GET request return value as error instead of success
- Get Custom taxonomy parent with wordpress REST API
- register_meta not showing custom post type metabox data in rest api
- why is apiFetch throwing Unhandled Promise Rejection: TypeError: Object is not a function
- WP_Query not ordering correctly
- 403 error rest_’cookie_invalid_nonce’ on API Request
- is it possible to fetch data from a remote api while admin is writing a new post?
- WC REST API Error Handling
- Generate Static Page to Show Search Results/Detail for API
- Hiding WordPress REST endpoints from public viewing using Basic Authentication
- React in plugins: REST endpoints vs. regular functions
- How do WordPress plugins work with oAuth2 APIs?
- Query only title/field/featured media of posts [closed]
- API WordPress is Limited? Return False
- Tie specific functions to options-update for limiting API requests
- Is there a way to tell if a shorcode’s handler is being run before or after the content formatting filter?
- Can a plugin differentiate syndication feeds from actual site views?
- Best place to keep files that are called by cron jobs?
- Developing a plugin, ran it through P3 Profiler, shows up slow, but I don’t know why
- What method should I use to store my plugin data (multi level menus with options on each item)
- Is it safe to use PUT and DELETE requests
- add_rewrite_rule not working
- How do I query posts and have their related taxonomies returned in the results?
- mysql_real_escape_string() error using xml2ary in WordPress plugin
- oneOf two possible objects in WP REST API?
- How can I send api calls from my plugin?
- Safe XML response from wordpress plugin
- Rest Api WordPress
- Programmatically creating posts based on external JSON feed (asynchronously)
- Is it possible to create post in wordpress using postman?
- esc_url, esc_url_raw or sanitize_url?
- Does WP REST API cache internally executed (rest_do_request) requests?
- Run different permission_callback depending on HTTP method of custom REST API endpoint
- How to get locale within WP REST Request?
- How to boost WP custom post REST API GET queries by custom taxonomies
- Images stored from external API not loading
- WordPress getting data from external API
- how to send csv file to other server using wp_remote_post?