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:
- Add a new tab to WordPress Plugin install Listing
- Changing Plugin Load Order
- Admin settings update updating every time home page is hit?
- Global Objects and Public Methods
- How should you hook a session_start() when authoring a plugin?
- Init action hook running late after PayPal’s return url?
- How do you use the plugin boilerplate loader class to hook actions and filters?
- How Do I Load My Action Earlier Enough?
- Does WP fire delete_post when trashed posts are automatically deleted?
- Why does do_action pass a blank string as the first parameter if no $arg is set?
- How to add a link to WordPress Plugin install Listing
- How to: Rest endpoint returning empty object
- I can’t find where a hook is being defined in a plugin – Easy Digital Downloads
- Call activation hook multiple times
- Two-step login process – Is it possible?
- How can I hook into existing WordPress Bulk actions?
- Hook for post permalink update
- Get returned variable from a function to add_shortcode function
- Earliest WP Hook to Safely and Reliably Redirect
- Define a function outside a class and call the function using action or filter hook
- Create a plugin to change the action to which a function is hooked
- Can I differentiate between “Delete Post Permanently” and “Empty Trash” and do something for each accordingly?
- Synchronize Custom post type tags to WordPress default posts tags
- What method to use to call a REST API?
- unable to stop loop when using wp_insert_post with publish_post hook
- Hook into theme-switching later than `setup_theme`
- Is it possible to delay execution of shortcode output callback?
- WordPress Ajax callback function from plugin – OOP
- Why my database table not created on activation?
- Act on user meta updated, but only once
- Where and how does WordPress store and use its plugin and hook information?
- Is there any way to allow a plugin to write over a previous version?
- edit_{$taxonomy} | Hook
- WordPress after content Hook & external template part
- WP REST API V2 – Add user data to response
- best practice for query string values – get_query_var always empty for my value supplied in query string
- get_current_screen() return null
- Modifying meta tags after doing ajax call in plugin
- how to add custom functionality after woocommerce place order button
- How to get results of subcategories also?(WP Rest Api v2)
- Where to add hooks in a class
- Conditional hook based on the core function that is calling it
- Adding option to Gallery shortcode
- Amending REST API function without deactivate/activate plugin every time changes is made
- Serve text/html from wp-json API via WPEngine, headers not being set properly
- How to do POST request with WP REST API v2 to custom table?
- I have 2 plugins using the same wp_login action hook and one is not working
- Add a new confirmation page before saving
- How dynamic action login_form_{action} is working
- How to get all queries’s results after they have executed?
- Custom Rest Endpoint: Post/Put/Patch not working
- flush rewrite rules after plugin update?
- After plugin activation hook
- Odd map_meta_cap $args on post edit — sometimes integer, sometimes string
- How can I create a custom plugin that allows anonymous users to signup without registering?
- hook filter after the_content on a specific page
- Associate multiple email addresses with the same user account, so they can log in with either
- Run command “composer install” when activating wordpress plugin
- Custom filter not working
- Mock a dependency of a WP_REST_Controller class
- Configure WordPress to Generate Scheme-less Relative URLs
- Ajax +wordpress onClick link redirect to new page and create html content
- How to replace settings in WordPress plugin from a theme
- Creating posts with links from a txt file
- Allow REST API Endpoint to specific user and hide from public
- 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
- Getting Post ID at “stylesheet” and “template” hooks
- Query String Filtering API
- 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
- WC REST API Error Handling
- Problem in plugin debuging in wordpress
- OOP development and hooks
- Plugin Development – Call to undefined function comment_exists()
- Add_action not calling callback function
- React in plugins: REST endpoints vs. regular functions
- Prevent plugin activation and add admin notice
- Function not working on any file other than the main plugin file
- Multi hook deploiement
- Can I use a hook other than ‘init’ to handle form submissions?
- 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
- How do I replace title with my plugin?
- Looking for Hook that is fired after a plugin or wp upgrade is installed/updated
- Woocommerce: block user removing cart item
- How can I get a plugin to hook ‘dbdelta_queries’ — a filter used during version update?
- Send retrieve password notification email with custom HTML email template
- How to update WordPress Plugins in your own maintance application?
- 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
- REST API error in block editor for custom templates