This isn’t how PHP works. A PHP class is not persistent, so setting a property when a shortcode is output is not going to affect subsequent AJAX requests, since the class instance is recreated on each request.
If you have a shortcode that has an “outlet” property that the user can use like this:
[wp_example_search outlet="google"]
And that shortcode outputs a form that runs an AJAX request on submission, and you need the AJAX response to know what “outlet” to use, then the only way to do that is to send that information along with the AJAX request. To do this the shortcode would need to output the relevant outlet in a hidden field or attribute so that the JavaScript can retrieve it and send it along with the request.
Related Posts:
- PHP Deprecated: Non-static method should not be called statically
- Adding Custom Fields for Img in Posts
- How To Ignore a Filter On Applying Filter the Content In a Function
- Calling function from within functions.php returns unwanted value
- shortcode doesn’t work
- Can’t get custom posts of taxonomy to show
- Shortcode to generate and save password in a file
- get shortcode value
- Storing Options in a Shortcode
- How to remove html code in excel downloads using phpspreadsheet with wordpress plugins shortcode
- How to put JQuery/Ajax inside shortcode?
- WordPress Shortcode to get URL Parameters $_GET[‘name’] redirects for no reason at all
- WordPress function not being called from jQuery method
- Nested shortcode functions accessing variable
- Some code in shortcode function being ignored
- How to Create a shortcode to this php function
- Redirect to another page using contact form 7? [closed]
- What is @Action in WordPress?
- Custom shortcode for displaying user based on a role parameter
- Return multiple values in a shortcode attribute
- Is there a way to convert shortcodes to html content?
- Shortcode not working – quotes seems strange
- Get all the URLs of the pages that uses a specific shortcode
- Add the_post_thumbnail_url to a shortcode in function.php
- Echo out element to another page.
- Adding a Tag Parameter / Filter to My Shortcode
- Creating New Dynamic Fields for a Certificate (Number Generation, Code Referencing, and more)
- How to get current cart values using WC_Shortcodes?
- get_post_meta shortcode returns empty field
- Why does my custom plugin only function correctly once per page?
- Hide content for specific users with id
- Why is my shortcode not working?
- Get Shortcode output to database for static post_content
- Query Shortcode from a multisite to appear on a different site?
- Find all strings between an enclosing shortcode
- Posting code inside the post instead of in the template file using shortcode
- How to Set Limit with WordPress Get Bookmarks Shortcode
- Creating Features List in WordPress Post
- Integrate Razorpay quick payments plugin with contact form7 plugin
- cURL External API request displays content above other content on page
- Subtract Using GravityWP Count Plugin
- How to get URL param for pagination in shortcode?
- qTranslate‑X is not translating all shortcodes
- How to add a shortcode button to the TinyMCE editor?
- how to include other plugins css files in a shortcode?
- Simple form that saves to database
- How to call plugin path in JS?
- Get Current user email as a return string value
- How can I make content disappear when a user logs in?
- How to save Clicks of a download link button while it doesn’t matter if we refresh the page or again login/logout
- New Plugin: Post update pushes a copy as a revision
- Overide a function that is inside a plugin
- Executing my function once on a specific time
- Adding Shortcode to Text Widget
- Why “Call to a member function on a non-object” in plugin only?
- What are the specifics of WordPress development I need to know? [closed]
- How to echo text in browser instead of download junk file?
- get_post_title is not working on homepage
- Can i add custom code in Source, Header from function.php?
- Problem with isset and $_POST
- Allowing users to Sign-up > Login > Post articles that need approval
- Adding a simple Javascript file with a plugin
- How to add/change (woocommerce) product tab icon
- How to write to a separate PHP file in plugin settings
- Get post content from outside the loop with plugin shortcode usability
- Dynamic Image Replacement through call rail phone call tracking plugins in wordpress
- How can I show registration form inside modal?
- Create Short code dynamically
- add_action for publish_post doesn’t work
- Custom Logo Link WordPress
- How to convert Currency from USD to other IP Based currency in Php function
- Attempting to list all product categories and the price range of all products within them
- WP Import All Multiple Dynamic Link Imports
- admin_notices show after load completed
- WordPress + python integration
- Newbie problem with adding include wp_footer
- Shortcode do not return the right data in post
- Display pagination in reservation Plugin and and Print table as pdf
- What is the right way to populate a dropdown from MySql?
- make p tag collapsed after 3 rows
- Generate and send ICS file through WordPress
- WP Plugin permissions – create new files
- Run a Change Role Cron Job on WordPress via cPanel
- How to use a shortcode of a plugin in another plugin php file
- Bootstrap carousel – Using shortcode inside enclosing shortcode
- Creating Admin Submenu Page via Class Method
- How to store multiple instances of the plugin’s options for various shortcodes
- .htaccess file doesn’t work, with hundred tries
- ACF Repeater Field Question [closed]
- How to create a dashboard for logged-in users with custom functionality? [closed]
- Cannot access variables within a widget
- How do I convince this button to do something when it is clicked?
- Doing action based on input from options menu
- WordPress User Frontend Editing Custom Fields
- How to use ‘Event Manager Shortcodes’ plugin via the php code? [closed]
- Fast Tranfering my WordPress site to another server
- Duplicating wordpress install issue
- Posts in Admin only display 1 Post instead of all Post in admin area
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- plugin doesn’t retrieve data from database