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
- What Are Security Best Practices for WordPress Plugins and Themes? [closed]
- Disable author pages for specific users
- Set active theme via URL
- Saving Plugin settings to the database
- Why users disable the WordPress update?
- I can’t upload a new wordpress theme from a zipped file
- Get list of sites that uses specific plugin or theme
- Woocommerce sidebar not loading in theme
- Deactivate Plugin on Theme Switch
- How To Clean The Malware Infected & Hacked WordPress Websites? [duplicate]
- AJAX button run function
- How to get current post user id
- Re-naming a theme/child theme whilst maintaining updates
- Unable to upload wordpress plugins
- The problem with WordPress Importer
- How to disable CSS rule in Twentythirteen style.css?
- Display post lists in 2nd paragraph
- How to display custom sidebar in wordpress 5.5.2
- Replacing a plugin function with a custom renamed function doesn’t work
- Linux Permissions and Ownership for WordPress
- Homemade plugin while using Themify Ultra
- Disqus deleted comments are syncing with wordpress but active comments do not
- Theme/Plugin installation through url on button click
- WordPress get_avatar function not correct working
- WordPress metaboxes – textfield suggestion automatically populated
- Which file of wordpress manage plugins functionalities?
- How to use get_template part in the plugin?
- How can I use get header from within my plugin?
- Improving the perfomance of a plugin action
- Check if variable is set in filter
- Basic gallery plugin suggestion [closed]
- Image change on hover
- How to write “alt” tag in image for wordpress code?
- Passing stored variables to add_filter
- How to activate a plugin on the activation of a theme?
- Using custom fields for image alt and title
- Where Should i write the code for wordpress ajax voting?
- How do I convert my WordPress website to be domain agnostic?
- Add the_post_thumbnail_url to a shortcode in function.php
- Add action to custom Function
- Show media-uploads to all users
- Cannot add edit themes and add plugins after multisite update
- Remove updates text on plugin or themes list page
- how can authors to define custom pages?
- Adding a Tag Parameter / Filter to My Shortcode
- How to prevent plugin, theme installation failures on WordPress?
- Edit all $wp_scripts at once to $in_footer = false
- How to upload large media file in chunks, without any plugin?
- WP Function does not trigger on Webhook API Call
- Why do I need to reload the page for WordPress to see the new custom field added with jQuery
- Cookie value changes back to previous value after changing
- RSS Feed on WordPress showing code (hypertext) in articles titles
- How Can I Increase Breadcrumb Position Count (Starting From 2)?
- Main content of site not showing, but does show when logged in to wp-admin
- How to add specific script to WordPress webpage that will working with user input and databases
- How to create algorithm for ordering posts in WordPress?
- Add external javascript to post template
- Set up new WordPress domain using unclear files
- Plugin function in child theme
- How to roll back WordPress version or prevent migration from forcing update?
- Multisite converted to Single Site can’t add new plugins or new themes
- Update (a function) post’s featured image as soon as $image_url changes
- How to link file or image from wordpress plugin dir to theme by using themes function.php, is it possible?
- Using activated_plugin to run code
- Why isn’t my plugin seeing other classes?
- Theme styling for plugins
- jquery-issue: cannot load the basic jquery
- functions.php conditional output for a single plugin
- Single dash converted to double dash
- How use Dynamic hyperlink on each wordpress post?
- Why do I get this “peer’s certificate issuer not recognised” error when trying to install a theme?
- Can’t modify plugin function
- Any plugin/theme available which suits my requirement? [closed]
- Two sites one PC
- PHP if url extension action=discussion condition use [closed]
- Option value not getting updated until page refresh in WordPress
- How to create an Info Box on WordPress [closed]
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode
- Any plugin installation and update overwrite current theme
- Problem on a wordpress website with a plugin [closed]