You can use deactivate_plugins() function to deactivate a plugin
if ( ! wp_next_scheduled( 'deactivate_plugin_conditional_hook' ) ) {
wp_schedule_event( time(), 'twicedaily', 'deactivate_plugin_conditional_hook' );
}
add_action( 'deactivate_plugin_conditional_hook', 'deactivate_plugin_conditional_2345678999343434' );
function deactivate_plugin_conditional_2345678999343434() {
$plugin_path="plugin-folder/plugin-name.php";
if ( is_plugin_active($plugin_path) ) {
deactivate_plugins($plugin_path);
}
}
You can set custom event see here https://codex.wordpress.org/Function_Reference/wp_schedule_event
Note: this is not tested code
Related Posts:
- Best collection of code for your 'functions.php' file [closed]
- How to include a plugin’s php file to another plugin functions file [duplicate]
- Limit access to posts/pages by user roles
- Remove Google Fonts Which Are (Probably) Added By Plugins
- if plugin is active? check if plugin is enabled or not?
- Common functionality between my own plugins
- Adding a text domain to every __(), _e() and __n() gettext call without a plan to create own translations
- How to override a theme function (within a class) using a plugin
- Editor access to plugin settings
- Seeking clarification on page request life-cycle
- How to assign user a role if none is present when logging in
- Saving Plugin settings to the database
- Custom Widget outputs the input but doesn’t save anything inside the textarea
- How to remove action from plugin?
- How to find out what blocks are added by a plugin
- Can wp_script_is used in pluginA check if a script is being enqueued/registered from pluginB?
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- plugin development: problem with functions
- AJAX button run function
- Dropdown menu on custom page with product to choose number of products per page
- How to append to title via functions.php for auto-posting plugin [duplicate]
- Bootstrap Drop Down menu is not working
- Custom random quote widget breaks when used in multiple sidebars
- How to change constants in WordPress wp-config.php programmatically?
- Override Plugin Script Fucnction in WordPress
- How to display custom sidebar in wordpress 5.5.2
- Replacing a plugin function with a custom renamed function doesn’t work
- How to call WordPress function other files
- Conditional attributes and logic per product category
- Disqus deleted comments are syncing with wordpress but active comments do not
- Ajax : Call undefined function plugin_function() … can’t call any plugin function
- bbPress plugin: forum lists not showing in correct order? [closed]
- What is @Action in WordPress?
- Is there a best practice remediation for PhpStorm’s warning that void function the_post_thumbnail is used?
- the_tags : can we insert a class
- How to over-ride a file in a plugin? [closed]
- Overwrite category head title
- execute function after one completed
- WordPress checkbox and Illegal string offset
- Undefined index: action plugin problem
- PHP script from functions php is loaded via admin-ajax to div…and the result is 0, not the desired content
- How to reset the plugins without deactivate the plugin
- plugins_url() works everywhere but wp_reqister_script()
- Replacing global wp_query
- How to get specific string/value from an array? php [closed]
- WordPress Stock Update Programatically
- 5 PHP Fatal error: Uncaught ArgumentCountError (Cannot Find)
- How can I fetch data from another website to my wordpress website with mysql database
- Getting a ressource ID, from a WC_Order_Item_Product/Order
- how to change wp-admin url using function file
- same user role or copy the user role to be same as the other role
- Expected ‘add_filter’ (T_STRING)
- Could not add ‘LoginLogout’ link using BAW login logout plugin
- Execute a function when the entire page is displayed
- How can i listing current category and Featured Category post list?
- How to add custom function to pluggable.php
- Adding a pagenavi to function for displaying bookmarks
- grab or load text on demand
- sliding/fading header plugin or approach suggestion
- What is the most efficient way of adding additional functionaliy for admin only
- Error Metabox Warning: call_user_func() expects parameter 1 to be a valid callback
- How would I get the new plugin version on this function?
- Cannot pass value variable to WP AJAX functions
- Sharing varible between two add_actions
- Search in WordPress
- Easiest way to load/fire a handful of functions, IF checkbox is checked?
- post id or permalink auto-incrementing number and reset everyday
- Modify function output in a plugin
- Override filter variable not working
- Get a Taxonomy values in an array
- Update (a function) post’s featured image as soon as $image_url changes
- Shows warning when enable “wp_gallery_custom_links” plugin with Themify Builder
- WordPress environment not loading properly
- Place content inside the Post Loop
- How to replace native comment_count with Comments Evolved aggregate count
- Follow author on muti-user WordPress site
- Hook into install email
- wordpress Shortocode running twice?
- Is there any wordpress function to update a random post every 10 minutes?
- Calling an custom field from theme option at the frontend
- pluggable function in theme, to be overridden by plugin
- Calling a function from a link in WordPress
- Saving an array to get_options
- functions.php conditional output for a single plugin
- Showing author box on post detail page
- Single dash converted to double dash
- add query string to all pages after user logged in
- How use Dynamic hyperlink on each wordpress post?
- Simple WordPress function / plugin to redirect a site
- Remove base from the custom post type URL [duplicate]
- is_plugin_active() not defined on active plugin, in the thumbnails.php file
- Requires PHP version 5.3.0
- Can’t modify plugin function
- PHP if url extension action=discussion condition use [closed]
- Show WooCommerce products based on query parameters on redirect
- wp_enqueue_script doesn’t load JS in plugin
- Read page- or post-content across different builder-plugins
- Remove posts that start with similar words (like a delete duplicate posts plugin)
- Secure way to add JS Script to WordPress filesystem
- How to access a function declared in child theme’s functions file in a plugin file?