Nope! There is no way.
variable scope is file based in PHP, It means you can’t access a variable or even function and class from another file unless you include that file inside current file or use other similar ways like namespace or API call to get desired value from the file.
you can read more about variable scope in PHP:
https://www.php.net/manual/en/language.variables.scope.php
Related Posts:
- Customizing subject in comment notification e-mails
- How to Loop Plugin Option Field Set?
- Saving Plugin settings to the database
- HELP: Integrating WP with raw PHP code once published button is hit
- I would like to use create a function in my custom plugin to tell WP to use a different header
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- wordpress plugin is not activating from widget
- Edit Yoast SEO breadcrumbs output [closed]
- Conditional attributes and logic per product category
- WordPress get_avatar function not correct working
- Redirect to another page using contact form 7? [closed]
- Check if variable is set in filter
- execute function after one completed
- Plugin onclick button activate other plugin
- Different registration form for different roles
- More gentle way to hook WordPress custom url
- How to add custom function to pluggable.php
- Checkbox show / hide output result
- Allow a particular user to access a particular plugin?
- Cookie value changes back to previous value after changing
- Is there any way to sync Facebook Comments and with comments on WordPress website?
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- adding dynamic/multiple slug values in ‘option_none_value’
- working code, not working – Plugin Dev
- Is admin section completely customizable in terms of styling?
- register_activation_hook doesn’t fire at all
- My ajax request don´t work and return 0
- WordPress environment not loading properly
- Populate select option with JSON file
- Saving an array to get_options
- Saving plugin data returns “You do not have sufficient permissions to access this page.”
- How to add a handler for a button in plugin?
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- Doing action based on input from options menu
- How use Dynamic hyperlink on each wordpress post?
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- Mixed results with is_page() WordPress function, when using $this, or self
- Read page- or post-content across different builder-plugins
- How to redirect Old Post URL to new Post and keep Old post Comments?
- Can wp_script_is used in pluginA check if a script is being enqueued/registered from pluginB?
- Modifying Footnote Plugin for Descriptive Title Attributes
- New Plugin: Post update pushes a copy as a revision
- Getting media library popup in custom plugin admin page
- Create or Update thousands of woocommerce products via PHP
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- send_headers don’t work on wordpress multisite
- jQuery function didn’t work in my plugin
- bulk change of image setting “link to” to “link to: image url “
- Placement of Code in Plugin for hooking `save_post`
- Display a text message if the field is not found and not if found
- Sanitizing, Validating and Escaping in WordPress (Plugin)
- Escape when echoed
- The Point of Using apply_filters()
- Plugin exceeds memory limit
- How to get post URL in the_content filter?
- Add a plugin before main container
- How to get subscription key or id using Woocommerce Subscriptions [closed]
- How to get variables from fucntion.php to my plugin files
- How to include code into functions.php file via a plugin
- Avoiding Duplicate function names in Post Loop (WP_Footer script)
- Missing argument 3 for wp_register_sidebar_widget()
- Write to / remove from default .htaccess file from plugin?
- Update Option Error: Notice: Undefined index
- How to add class in plugin only for network site?
- Plugin Development sqlite or WordPress’ database
- How to cancel WordPress’ action/filter when using OOP with anonymous callback
- How to trigger $_GET request within admin plugin page?
- How to generate video out of images via WordPress plugin
- plugin development: problem with functions
- How can I get WordPress to save comments in markdown format?
- add_query_arg not working
- WooCommerce get_price returning wrong price when used via ajax
- How to ‘clone’ a wp plugin to make small changes
- Open Post Thumbnail in New Child Theme File in WordPress
- Shortcode button dosent work for all posts. Work for first post only
- Where should I save an API key of my user when installing my plugin?
- Is Wrapping intval() Around esc_attr() Redundant for Escaping Input?
- Programatically download a plugin
- Redirecting to home page after login as custom role WordPress
- Add keywords meta to index.php page
- Custom form action to handle data inside a plugin
- Self deactivate plugins after an action occurs
- Pulling data from custom plugin settings using PHP shortcode and Javascript
- Executing my function once on a specific time
- How to periodically scrape and cache strings from remote txt files. – My First Plugin
- How to stop or remove an action being called inside a function of an extended class
- WP Post Template – Templates in own folder
- Avoid class name collision when using third party libraries in plugins?
- Theme my Login plugin, how to update fields
- Date calculations from 2 custom fields
- How would I go about creating a user ranked post popularity page?
- Redirection of users away from wp-admin (but not administrators)
- Using a custom plugin to capture input data via Ajax and PHP
- Display post lists in 2nd paragraph
- Using a post-signup hook to get user details
- How to enable specific plugin only based around shop manager role?
- Override Plugin Script Fucnction in WordPress
- code is working properly in Core PHP but writing coding in WordPress
- Creating a custom post type, adding custom meta fields, preventing all future editability of posts of this type