It’s not possible to pass data from one HTTP request to another one on the fly. Once the script is finished, the data will be discarded.
What you can do is to store the data in a transient, and then retrieve it later. Here’s a simple example using set_transient():
set_transient( 'my_transient', $data, 1 * HOUR_IN_SECONDS );
Then, you can retrieve it using get_transient():
get_transient( 'my_transient' );
Related Posts:
- WordPress and event-driven programming – what is it about?
- Receiving Stripe Webhooks on a wordpress website
- Change the footer text on the login page
- How to remove a metabox from menu editor page?
- Multiple wp_schedule_event cron jobs in plugin cause multi-execution
- How to remove “out of stock” variation options from size dropdown in woocommerce?
- Audio Player not loading when the content is loaded through Ajax, MediaElement.js no applied
- Hooking new functions to actions + passing parameters
- Find variables available at a given hook
- Is $hook a global variable in WordPress
- Replace existing content from specific WooCommerce admin orders list column
- enqueue hover function
- WooCommerce: Add Payment Gateway Field to Webhooks [closed]
- action hook wp_head higher priority as all other plugins/hooks
- using add_action for a header hook that has an additional parameter
- When using the_author hook, how can I determine the PHP file that generates each call to `the_author()`?
- How to call function at the bottom of post using plugin?
- Randomise upload filenames (or another solution to hide the original image URL from theft?)
- Setting up 2 SMTP accounts: 1 for wordpress and 1 for woocommerce
- Handling Body class based on Template
- How to load a template-part based on a url wildcard?
- Remove an action hook within a Class
- How to pass arguments to add_action() or retrieve return value of called function?
- ajax, right way to do it and make it works?
- Sending data from custom inputs in WordPress comment form in the admin notification email
- Edit incorrect password message WordPress
- Reload part of checkout on changed shipping method
- Trying to build simple deposit code that hooks into woocommerce
- Contact Fom 7 – how to add custom HTML inside span.wpcf7-form-control-wrap AND IMMEDIATELY AFTER input.wpcf7-form-control?
- Woocommerce: hook action/filter I could use to add variation id and price with each attribute opt on WooCommerce Rest api
- Remove metabox from WordPress menu editor page?
- Remove a div from RSS feed
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- user_profile_update_errors hook not executing
- Set meta field to publish date + 2 weeks
- How to add an arrow to menu items has submenus
- WordPress Gravatar filter is removing my custom attributes
- Error in custom php function doesn’t exist
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- Don’t insert if permalink is the same?
- Adding widgets to my plugin page instead of WordPress dashboard
- Modify custom field input data before creating a new post
- how to make custom ajax handler?
- Are all hooks/functions tied to Kses meant for sanitization?
- Why does wp_head hook my functions to the beginning of my source code?
- Pass argument to event hook
- Password minimum length in personal subscription [closed]
- Theme activation hook in php class
- How to remove the message ‘We could not find any results for your search’ without changing template files and without adding posts/pages?
- How to catch wordpress post ID when it’s published
- Why does the post_type_link hook everything twice?
- How can I hook into the wp_mail function used by BackWPup?
- Can not add admin notices from the edit_user_profile_update hook (notices not being displayed)?
- Send notification email to admin for every new post published
- Adding function to child theme’s function.php
- Comapare get_user_meta value
- Add a custom class to the body tag using custom fields
- Why doesn’t global $wp_query not get hooked?
- Creating customized php files in theme folder
- How to pass hook variable to function?
- How to sort WooCommerce products page by latest in-stock items first?
- Filter wordpress posts without searching the keywords in the post content
- Removing “There is no account with that username or email address.” error message in “/wp-login.php?action=lostpassword”
- How do I add a function to parent theme
- Display custom field value in woocommerce variable product via jQurey
- Prevent header and footer from loading on specific pages with template or plugin
- Show full post instead of excerpt
- Use wp_head hook on template page
- Adding custom field to product category and show it to shop/category shop page
- Preserving backslashes in post_content
- How to edit post meta data before publishing the post it self wordpress?
- Fatal error: Uncaught Error: Class ‘WP_Block_Styles_Registry’
- Call a single function on two different methods with hooks
- Custom meta box is not displaying value showing tag as empty
- using filter and hook inside class
- Get original value in save_post action hooka
- Discount in the specific product title using keyword ( Woocoommerce )
- get Woocommerce product format json for WP_Query
- Register/enqueue scripts only on certain admin pages
- Is there an option to execute javascript file only on plugin activation
- How do I remove an action hook inside a class that is called by another class?
- Help hooking into user_register
- add_filter() inside another add_filter()
- Hook into all password resets in WordPress and get password before hashing?
- Getting page / post URL on publish and / or update
- Why transition_post_type hook is called twice for the same post?
- Clone the “proceed to cart” button and place it above checkout on the cart page, but only appear display size is 320px
- How can I move the posted-on date above the post and below the entry-header?
- Passing link parameter values to form
- Post formating on Home page
- WordPress HTML Helper
- calling a function from a class in your template
- Cannot modify header information – headers already sent
- For each loop will not append to the_content hook
- Change Checkout “Place Order” text if cart has a specific product
- understanding wp_next_scheduled
- Add/alter image attribute before render
- Facing Problem While Running WordPress Hook For Archive, Categories, Author, Date Pages Only
- Is there a hook that I can use when a fatal error occurs?
- Is there a way to pull remotely generated XML, process it, and display it on a Managed WordPress page?