You cannot do that in a theme, because themes are loaded after plugins.
Use a custom plugin, maybe a mu-plugin to be sure, because they are loaded earlier than normal plugins.
Related Posts:
- Disable plugin / plugin action via theme
- Shared functionality in plugins and themes
- Need to create a Theme demo site that features multiple themes
- Override the core function locate_template
- Set WordPress Featured Image For All Post Slugs Matching Image File Name in Specified Directory
- Fatal error: Call to undefined function cmsms_theme_page_layout_scheme()
- All sites themes functions.php have been changed
- Overwrite category head title
- Proper way to use plugin functions in functions.php
- How to make a dynamic css class whose name changes every visit to confuse scraper
- Removing the custom_image_header from wp_head
- What is the most efficient way of adding additional functionaliy for admin only
- Hide Plugin Custom Post Type Menu Link
- Securing langugae folder
- How can I make the search bar in my wordpress site search all of the pages rather than just the blog posts?
- Shows warning when enable “wp_gallery_custom_links” plugin with Themify Builder
- How can I add a custom checkbox / radio button on the admin theme options to display a CSS or other?
- How to Call Function From Separate WordPress Install on Same Server?
- pluggable function in theme, to be overridden by plugin
- Can’t get custom user meta to show in header
- how to get path to images in the uploads folder to be used in a plugin
- Replacing Icons in the Dashboard
- How can I have two different urls for the same page that load two different templates?
- How to enable edit button in the theme’s customize UI?
- Ship plugin with a custom theme
- wp_insert_user – how to send verification email before logging in
- Is the WordPress HTTPS Plugin Still Safe To Use? [closed]
- Post source link plugin – small modification
- Which hook callback has priority if both plugin and theme use the same hook?
- How do you auto-activate plugins from child themes
- Force wordpress to request for FTP Info on theme/plugin install/update
- WordPress 5 upgrade: until when is it safe to keep project running in 4.x?
- How to get post URL in the_content filter?
- May i Use ShortCode in Template?
- Pass info from functions.php to plugin
- add_query_arg not working
- Uncode theme content block header ignoring saved changes/not updating?
- Theme and plugin install or update display error in localhost
- Reduce Drop down Menu Width in WordPress
- Theme my Login plugin, how to update fields
- Create custom registration form for WordPress Multisite
- get current date + 90 days and checking every day
- Classified ad website : which solutions to use? [closed]
- How to create an input field, and base the output on spreadsheet data? [closed]
- posts comments goes to trash
- Advanced Custom Field DatePicker [closed]
- Admin style for just one plugin in dashboard
- What will happen if i deactivate my visual composer plug in? [closed]
- Finding the URL to be used to check if plugin is installed with a theme
- WordPress 3.8.3. custom theme – sliders won’t load js/css files
- “No Add Button” for me to customize my WordPress with themes and pluggins
- How can I list all installed plugins/themes/versions from CLI/API?
- Cannot get wpdb data (Error in a simple fuction) [closed]
- Why does my file_exist check fail?
- How to protect WordPress from security scanner [closed]
- how can I query all wordpress users of a blog
- Return multiple values in a shortcode attribute
- get specific value of a array | PHP
- Is it possible not to load theme on a specific page in wordpress?
- How to extract a .wp-env.json or composer.json containing plugin versions from a production website?
- Blocking Plugin Css to load custom in template directory
- Different registration form for different roles
- After a manual update, themes and plugins that were installed (and still in the directory) are not being seen
- Display WordPress comments before the plugins?
- Mobilepress fails to translate short codes
- Create a pdf from the entries in DB
- How to override any plugin file in the child theme
- add_rewrite_rule to load different page, without changing URL in browser
- Replace old theme that understand old css (vcex_icon_box css_animation)
- Mobile Menu and Mobile Sidebar missing
- custom fields not displaying on wordpress site
- Overriding a function in a WordPress plugin
- Adding discount functionality to the cart
- Precheck fields when I add a new post
- How to get a post views count using ‘WordPress popular posts’ plugin
- Get Shortcode output to database for static post_content
- Can’t add new plugin or themes on a wordpress multisite network from the primary site as administrator. Error: ERR_TOO_MANY_REDIRECTS
- How to prevent redoing get_posts queries and make results available to other scripts?
- WPML – Hook when language is switched (change user language)
- Change custom rewrite rule when permalink is updated/changed
- Google trying to index child theme files
- How To Add Code To WP Without Plugin or Functions
- In the WordPress API is there a way to set the width of the post/page container
- plugin not hooking to my custom hook
- Populate select option with JSON file
- Home page letters
- Find all strings between an enclosing shortcode
- What Are the Advantages of Using an mu-plugin
- Automatic updates of plugins and themes outside of wordpress.org
- wordpress Search function is not working
- Why does theme need woocommerce to show images / content on front page?
- PHP Creating a formula from mysql db values and db stored math operator
- My Blog page ( posts page ) theme isn’t changing with the new theme [closed]
- Option value not getting updated until page refresh in WordPress
- How to create an Info Box on WordPress [closed]
- WordPress Custom Page Blog Template Pagination Problem (Pagination Not Displaying)
- Problem on a wordpress website with a plugin [closed]
- stop resize button for wordpress media
- Mixed results with is_page() WordPress function, when using $this, or self
- Add new Plugin or Delete option Not Showing and Also Theme delete option not showing