Solution to White Screen of Death that does not require Web Server access?

I'm working on a live website, updated a plugin and got the dreaded White Screen of Death. I know exactly how to resolve the problem; simply deactivate or delete the plugin I upgraded. The problem is I cant access the WordPress Dashboard to deactivate or delete the plugin. The WSD occurs in /wp-admin aswell. To make things worse the owner doesn't know their web server login credentials so I cannot just FTP or CPanel in and delete the plugin that …
Category: Web

How do I disable Pods/Elementor while using Ninja Forms?

There's a conflict when using Pods, Elementor, and Ninja Forms together. This is a known issue by Ninja but the other players are uncooperative and Ninja is still a little ways out on a real fix. The conflict manifests by displaying a blank page when trying to edit a Ninja Form. At least in theory, if I can just disable the functionality of Pods or Elementor while I'm editing forms, I should be fine. I've attempted to deactivate_plugins on admin_init …
Category: Web

Deactivate Plugin on Theme Switch

I am developing a plugin, let's call it DahPlugin, that provides additional customizer options for a free theme I developed. Let's call this theme DahTheme (I don't want to shamelessly plug either one of them here). So what I am trying to accomplish is, I would like for DahPlugin to be automatically deactivated the when the user changes themes away from DahTheme. I found this code snippet here: disable active plugins for specific theme, which works really well if you …
Category: Web

Wordpress Plugin Activate / Deactive Failing

Below is my plugin.php file that would install into wp-content <?php // If this file is called directly, abort. namespace Booker; if ( ! defined( 'WPINC' ) ) { die; } /** * Currently plugin version. * Start at version 1.0.0 and use SemVer - https://semver.org * Rename this for your plugin and update it as you release new versions. */ define( 'PLUGIN_NAME_VERSION', '1.0.0' ); /** * The code that runs during plugin activation. * This action is documented in …
Category: Web

Must activation/deactivation functions in a class be static?

The description for register_uninstall_hook's $callback parameter states: Must be a static method or function.1 There is no such comment for register_activation_hook or register_deactivation_hook. However, in the Codex entry for register_activation_hook there is an example that reads: Or, because the activation hook requires a static function, if you're inside of a __construct():2 In a GitHub issue, "why is activate a static method?", a user states: You can't define them as standard functions because they require an instance of the plugin to …
Category: Web

Is there an option to execute javascript file only on plugin deactivation

I'm creating a custom plugin for WordPress and I'm trying to execute javascript file only on plugin deactivation. I'm using register_deactivation_hook() and wp_enqueue_script() to execute file only on plugin deactivation. There are no errors in the code since the javascript code works well if it is called outside the register_deactivation_hook() This is what I've tried so far: register_deactivation_hook( __FILE__, 'deactivation' ); function deactivation() { function delete_rest_api() { wp_enqueue_script('deactivation_data_api', plugins_url('assets/js/deactivation_data_api.js', __FILE__)); } add_action( 'admin_enqueue_scripts', 'delete_rest_api' ); } In the end, the …
Category: Web

How to Modify/Change a Buddypress/Wordpress Account Activation Process

I'm developing a custom BuddyPress/WordPress Plugin. Here's how a user would normally register. A user registers as usual on registration page His/Her account is deactivated till he/she clicks on activation link in his/her email He/She is sent an activation link through the email he/she registered with He/She activates his account by clicking on the link I'd like to modify step 4 above so that even if the user clicks on the activation link, his/her account remains deactivated till he/she fills …
Category: Web

Unset plugins on front-end belonging to specific category

I have a function which unset plugins on the front-end. The only extra criteria, in_category ( 'my-cat-name' ), I am not able to achieve. Where and how to add the category so the plugins are only unset on post types which belong to this category? I tried if( !is_admin() && is_category('my-cat-name') ) but that seems not correct. Below the code I have add, in a separate file, in the mu-plugins folder. As it is now, the plugins are removed from …
Category: Web

Disable WooCommerce action

I'm customizing a WooCommerce theme and am going to be moving the title. There is an action in content-single-product.php called: do_action( 'woocommerce_single_product_summary' ); in the woocommerce_hooks.php file the title action is: add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 ); I can easily comment this out and place the title function where I need to. I'd prefer to disable the title using a function in my themes functions.php file so I don't have to worry about modifying core files. What would the function be …
Category: Web

is_active_sidebar() problem

I'm trying to develop a wordpress theme with a hero slider, I use some 3rd party slider widget inserted to the hero widget area I've defined as sidebar-hero in my functions.php file. I'm using this code to display the hero slider: <?php if(is_active_sidebar("sidebar-hero")) : ?> <?php dynamic_sidebar("sidebar-hero");?> <script type="text/javascript">document.body.classList.add("hero-widget-enabled");</script> <?php else: ?> <div class="carousel-page-container container"> <div class="header-filter" style='background-image: url(/wp-content/themes/sometheme/assets/images/demo/back.png)'> <div class="header-filter-gradient"></div> </div> </div> </div> <?php endif;?> Now the problem is, I add the custom slider to the sidebar-hero widget area, …
Category: Web

disable active plugins for specific theme

I want to disable some plugins from a specific theme.I am using deactivate_plugins hook to deactivate. following is my code. add_action('wp_head','disable_plugins'); function disable_plugins(){ include_once(ABSPATH.'wp-admin/includes/plugin.php'); $current_theme = wp_get_theme(); $current_theme_name = $current_theme->Name; if($current_theme_name == 'Twenty Sixteen'){ if ( is_plugin_active('press-release/init.php') ) { deactivate_plugins('press-release/init.php'); } } } This code deactivate plugins at wp_head hook but issue is I want active plugins to disable only when theme is Twenty Sixteen while wants to keep enable or disable as it was already on other themes. But …
Category: Web

OOP: Display warning and deactivate the plugin if PHP version is less than 5.4

I want to show a notice to the user and deactivate my plugin, using OOP code style, if the user has a PHP version less than 5.4. The code works fine when I create my plugin using non-OOP. It shows an warning to the user and deactivate the plugin and prevents user from activating the plugin. Working code is given below: Non-OOP // check for required php version and deactivate the plugin if php version is less. if ( version_compare( …
Category: Web

Remove Action from Plugin within extended class and no assigned variable

I have tried so many solutions for this but I can't figure it out. Here is a simplified version of the plugin code: class YITH_Vendors_Frontend_Premium extends YITH_Vendors_Frontend { public function __construct() { add_action( 'woocommerce_register_form', array( $this, 'register_form' ) ); } So I want to remove this action from my child themes function.php. The problem is the class is not instanced via a variable. Instead it is instanced like this: class YITH_Vendors_Premium extends YITH_Vendors { public function __construct() { public function …
Category: Web

Plugin Deactivate Self on Activation Errors

Hi I'm wondering if someone can point me in the right direction here. I'm having trouble figuring out how deactivate_plugins() works. I've been using variations of the below for awhile now and it's always seemed to work until recently. register_activation_hook(__FILE__, 'my_plugin_activate_deactivate'); add_action('after_switch_theme', 'my_plugin_activate_deactivate'); function my_plugin_activate_deactivate() { if ( !function_exists ('mythemename') { deactivate_plugins( plugin_basename(__FILE__) ); } } The first problem is that the register_activation_hook part doesn't do anything at all... the plugin activates regardless of whether or not mythemename function exists. …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.