One way could be to use classes and objects. It’s more efficient considering reusability, collective work and more. I don’t think it’s bad to use global variables if you know what you’re doing.
So I would recommand you to use OOP (object oriented programming) especially with inheritance and polymorphism.
Related Posts:
- Why is one phpunit test throwing an error on one class when all other classes are similar without error?
- Sanitizing, Validating and Escaping in WordPress (Plugin)
- Escape when echoed
- Scope for PHP Variables Assigned in functions.php or a plugin
- Plugin exceeds memory limit
- How to initialize something in unit test before the init hook being called?
- Write to / remove from default .htaccess file from plugin?
- Update Option Error: Notice: Undefined index
- Plugin Development sqlite or WordPress’ database
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- How to trigger $_GET request within admin plugin page?
- How to generate video out of images via WordPress plugin
- How can I get WordPress to save comments in markdown format?
- 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
- 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
- How to periodically scrape and cache strings from remote txt files. – My First Plugin
- WP Post Template – Templates in own folder
- Avoid class name collision when using third party libraries in plugins?
- wordpress plugin is not activating from widget
- Edit Yoast SEO breadcrumbs output [closed]
- 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
- 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
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- Image upload and download from front-end
- wp_remote_get() returns 403 while file_get_contents() does not
- How to output CMB2 select options from repeated groups select elements?
- Creating a Callback URL for WordPress Woocommerce to update Order Status
- 306 MB of wp_options occupied by WordPress SEO Plugin, is that normal? [closed]
- What are the specifics of WordPress development I need to know? [closed]
- Ajax call returning 0
- How to deal with WordPress and Pocket API to automate content curation on my hosted wordpress blog? [closed]
- WP All Import – Execute Imports
- How to replace WordPress Media Upload Window with user’s device window?
- Conditional attributes and logic per product category
- How to create a custom post type that contains another custom post type?
- Perform internal redirect in WordPress?
- How to prevent plugins from loading jQuery
- WordPress get_avatar function not correct working
- Redirect to another page using contact form 7? [closed]
- Setup wp_schedule_event within a custom plugin
- Create a plugin from within WordPress
- Class variables not correct on page
- Activate my plugins via FTP
- Duplicate results are displayed in a custom plugin [closed]
- Check if variable is set in filter
- Saving an array to get_options
- Saving plugin data returns “You do not have sufficient permissions to access this page.”
- Plugin Breaking WordPress Login
- How to get site homepage from plugin?
- 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
- Undefined variable _POST
- Help me with my first very basic plugin
- Load my plugin before cache
- How use Dynamic hyperlink on each wordpress post?
- Unable to show 4 products in a row
- How to fix ‘Call to undefined function do_settings()’ error?
- What is the source outline for a basic word press plugin?
- My wordpress website admin panel loads very slow, what can i do about that? [closed]
- Submit posts in two different post types with the same form
- wordpress select multiple options and illegal string offset ‘timeslot’ [closed]
- how to search through plugin in wordpress cimy-user-extra-fields?
- How to create post comparison in wordpress
- What can I do to customize a widget provided with this plugin? from where have I to start?
- How to add custom html to the Media > Attachment Details modal?
- Displaying Category Feature image on loop
- Function not being called on form submit, only blank admin-post.php page
- wp_handle_upload – specified file failed upload test
- 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?
- How to override plugin function in code snippets WordPress
- How to make a Template page to show the information of different things Shop and Product page?
- How to create a “Most Popular” & “Latest” TAB in WordPress
- How to trigger plugin migration code when plugin updates?
- How to Save Category and Delete Category in same Function
- WordPress Throwing Deprecated Errors on its own Files
- Testing Plugin – Install plugin dependencies in testing enviroment
- public custom posts not showing in my wordpress plugin
- Use inline callable for hooks and filters
- Error in using ‘admin_enqueue_scripts’ action through a class
- plugin doesn’t retrieve data from database
- Accessing Correct Database to Create REST API Endpoint
- Mixed results with is_page() WordPress function, when using $this, or self
- add_action() not working for admin
- REST API – filters not working inside plugin class
- Read page- or post-content across different builder-plugins
- How to make WordPress Plugin run on single specific Admin Page