You can look into queues e.g. create a custom database table, and write to it within the rest_post_dispatch
or rest_pre_serve_request
filter just before it is dispatched.
Then you can bulk process the queue (first record in is the first record out) via e.g. wp-cron
and the user will not be affected by that potentially heavy processing. A custom column for the processing status might be useful as well.
With a real cron (not wp-cron) you could better control the timing/frequency of the processing.
Related Posts:
- Custom filter not working
- hook update_option/updated_option empty $old_value and $value
- Mock a dependency of a WP_REST_Controller class
- update_callback is not working in register_rest_field
- REST Endpoint API 404
- Configure WordPress to Generate Scheme-less Relative URLs
- Hide one specific woocoomerce product
- How to find list of all functions bind to a particular hook from my plugin?
- Can I Hook Into the TinyMCE Insert/Edit Link Button to Use Shortlink For Post?
- Using init hook for register_taxonomy is causing invalid_taxonomy in wp_insert_term()
- Ajax +wordpress onClick link redirect to new page and create html content
- How to replace settings in WordPress plugin from a theme
- Redirect returning users to a certain page?
- Restrict certain actions to plugin-specific admin menu pages only
- Creating posts with links from a txt file
- Set the payment processor callbacks to a plugin
- 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 do admin ajax request in a plugin for rest api
- Action / Hook when a new plugin is added
- apply_filters() and call_user_func() to define and call a function outside a class
- Attaching Image-file to userId
- Getting Post ID at “stylesheet” and “template” hooks
- Query String Filtering API
- How to enhance a self developed plugin by its own plugin architecture
- Trigger function on Remove block or add new block in Gutenberg JavaScript
- Custom plugin & calling REST api of wordpress instance the plugins is running on
- GET request return value as error instead of success
- How to update global variables in plugin activation callback?
- Woocommerce get_term_by() in transition_post_status hook doesn’t works
- How to query a nested field in wordpress api using _fields param
- Add two button to page and post admin to redirect to : add new & list of (posts – pages) just after saving post or page
- Get Custom taxonomy parent with wordpress REST API
- register_meta not showing custom post type metabox data in rest api
- `registration_errors` filter doesn’t seem to be called
- why is apiFetch throwing Unhandled Promise Rejection: TypeError: Object is not a function
- How to grab data after wp user search is complete
- Limit get_next_post to posts from the same author
- Securing custom rest API endpoints with public access from PWA
- WP_Query not ordering correctly
- 403 error rest_’cookie_invalid_nonce’ on API Request
- Any way, hook to add content right before the “read more” link?
- Is there any way to get post meta from publish_post hook?
- Why does do_action pass a blank string as the first parameter if no $arg is set?
- Add a custom submenu under submenu in a Custom WordPress Plugin
- Adding Amchart Interface to WordPress API
- get Woocommerce product format json for WP_Query
- WC REST API Error Handling
- How do I ensure I can loop through every enqueued script and CSS?
- Hook for validating and rejecting frontend image upload
- Does hooking into a plugin action / filter override the plugin’s function for that hook?
- Nested Hooks with do_action for performance reasons – safe/necessary?
- Initializing rest endpoint issue
- Problem in plugin debuging in wordpress
- WordPress Plugin Boilerplate – add actions and/or filters based on user’s role
- OOP development and hooks
- Plugin Development – Call to undefined function comment_exists()
- remove different admin menu for specific users
- Multisite and the JSON REST API: How to?
- Add_action not calling callback function
- React in plugins: REST endpoints vs. regular functions
- replacing jquery google cdn with a new version dynamically
- Prevent plugin activation and add admin notice
- how to retrieve post_id under woocommerce_add_to_cart_validation hook?
- How and when would I implement some code which would take data from one part of the Db and put it in another?
- add_option_{$option} action hook not being called
- Unable to show a message after plugin activation
- plugin modal/popup integration best practice
- Function not working on any file other than the main plugin file
- Query only title/field/featured media of posts [closed]
- WP API users per page
- Does WordPress have something like timer hook?
- Multi hook deploiement
- Can I use a hook other than ‘init’ to handle form submissions?
- Template file structure , wordpress hook for altering the template
- woocommerce single product page hook not working
- How can I set a dynamic value for post_updated_messages based on return value of post_updated?
- Best place to keep files that are called by cron jobs?
- What is the use of wp_schedule_event hook?
- Is it safe to use PUT and DELETE requests
- Is it possible to make WordPress as a RESTful app?
- How do I replace title with my plugin?
- Looking for Hook that is fired after a plugin or wp upgrade is installed/updated
- Get user logged in status from within a plugin. $current_user not defined
- Woocommerce: block user removing cart item
- how to insert content into wp_head after loop_end
- Insert plugin html content to a specific spot in the frontpage
- Apply function on all action hooks?
- How can I get a plugin to hook ‘dbdelta_queries’ — a filter used during version update?
- oneOf two possible objects in WP REST API?
- Send retrieve password notification email with custom HTML email template
- Send Webhook when post-status is publish or trash
- Using “add_image_size” to register custom image sizes inside plugins not working
- get_term_by() returning null on plugin
- wp_head is not fired from the hook I have used in my plugin
- How to update WordPress Plugins in your own maintance application?
- Trigger a JavaScript function based on the data fetched from Woo commerce hook
- Extend Plugin that creates an endpoint for GET request to also accepts POST requests
- How can create a custom plugin to call my webapi after any registration or membership plugin functionality
- Rest Api WordPress