They’re just two different ways of doing the same thing. It’s up to you which one to use, or whether to use both. Neither is ‘correct’. Use whichever makes more sense to you with the structure of your plugin.
Related Posts:
- Uninstall, Activate, Deactivate a plugin: typical features & how-to
- How to delete custom taxonomy terms in plugin’s uninstall.php?
- uninstall.php file in Plugin to clean DB
- How to delete custom taxonomy terms in plugin’s uninstall.php?
- Remove .htaccess portion upon plugin deactivation?
- Can plugin2 uninstall plugin1 at the very beginning of plugin2’s installation?
- plugin uninstall function drop the tables, but shows errors on admin
- is_plugin_active function doesn’t exist
- How to call a plugin function from index.php
- Rewriting every url
- Where can I find a schema of wordpress plugin core architecture?
- How can I make my custom shortcode work in a Custom HTML Widget?
- How Does WordPress Uninclude/Deactivate A Plugin?
- Memory Leak in plugin action
- WordPress network: set themes and plugins for new blog
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- How can I add a custom meta value on file upload?
- Admin-ajax.php is dying “0” without processing function
- How do I register a stylesheet inside a WordPress widget?
- Add a Custom Permalink option in the Permalink Admin Screen?
- How to remove an Ajax action
- How Can A Plugin Hook Itself To the End of Every Excerpt?
- Allow Facebook to preview posts before published
- Has anyone used require.js for handling plugin scripts?
- publish_post plugin hook doesn’t always pass $post->post_content
- Multiple files in a plugin
- Let user subscribe to specific categories
- adding a new value to a serialized array in WP_option table
- add action for displaying posts using a shortcode
- Write to / remove from default .htaccess file from plugin?
- Best way to hook a custom url?
- How to cancel WordPress’ action/filter when using OOP with anonymous callback
- What is the best way to mimic a search query within a plugin
- Remove rewrite rules generated by plugin during deactivation
- Programatically download a plugin
- Create dynamic page content from custom WordPress plugin page
- Correct way to perform non-cacheable DB query
- WordPress Gutenberg react make import of __experimentalUseInnerBlocksProps which is no more experimetal
- How to stop activating a plugin and show admin notice when dependent plugins minimum version is not met
- Fixing WordPress’s Bug (failed to send buffer of zlib output compression) results in “White Screen of Death”
- How can I make my metabox appear?
- Consolidate plugin functionality into a theme
- qTranslate remove default directory from link
- Custom message on plugin uninstall
- Adding CSS to custom post type admin page causes error
- Create shortcode to echo javascript
- Redirect to another page using contact form 7? [closed]
- wp_list_table class is not safe to use
- Separate database for a wordpress plugin
- WordPress Multisite: Programmatically Activate / Deactivate a Plugin of a Specific Blog
- remove all submenus from plugin
- How to prevent plugins from sniffing/stealing other plugins’ options?
- Hook for page Request?
- SMTP Error: Could not authenticate [closed]
- composer not working on my plugin when i upload it to my website
- What is the WordPress approach to custom data?
- How to delete all categories programatically?
- How to use custom Javascript code inside a plugin?
- Adding submenu to custom plugin menu page created with add_menu_page() function
- How to render a template file using shortcode inside a plugin
- How to rewrite URL and get the values?
- Does WordPress check for updates of a plugin via plugins root folder name?
- Delete data from custom table when deleting a post
- Disable plugin visibility at the plugin directory
- How do i ‘deactivate’ a plugin only on a certain page template?
- Need to add/remove group of options and display them as rows
- How to deactivate my plugin upon deactivation of NextGen
- Paypal Framework
- Widgets are not displaying in the admin panel
- Order by post_date does not work in Previous and Next post pagination
- Content-Security-Policy implementation with WordPress W3Total Cache plugin installed
- Fatal error “Call to undefined function is_plugin_active” each time the plugin is activated
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- How to get the checkout form data from checkout page when place-order button is clicked
- Getting Fatal error: Uncaught Error: Call to undefined function plugin_dir_path() when linking to another file within my wordpress plugin
- How to make WooCommerce multiple filter with custom meta fields
- How to write different events from different functions in my file to a log file in WordPress
- Create a form and have custom menu display based on user answers?
- How to make a plugin api route have permission?
- Modify Plugin PHP Class in Child Theme – Correct Method
- Call function when save setting/option in custom admin page
- Problem with conditional woocommerce custom checkout field
- Plugin to Delete All Posts Monthly
- mailjet plugin – extend functionnalities and reuse api
- Change wp_mail SMTP settings for each E-Mail
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- WordPress Thumbnail add action if no thumbnail
- Creating fields in the database
- Pass strings to plugin function [closed]
- contact form 7 captcha support anyother captcha plugin? [closed]
- How do I set register_meta for a specific CPT?
- How to Enfroce Domain Licensing Limits? [closed]
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- Update Content for a Custom Block Toolbar Button
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- Wrong block appender button showing
- Uncaught Error: Cannot use object of type stdClass while showing the list using WP_List_Table
- Submitting form to admin-post.php WordPress
- WordPress Throwing Deprecated Errors on its own Files
- plugin doesn’t retrieve data from database