php mu-plugin carga condicional插件
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php mu-plugin carga condicional插件相关的知识,希望对你有一定的参考价值。
<?php
// My post: https://es.wordpress.org/support/topic/tutorial-como-deshabilitar-algunos-plugins-de-algunas-paginas-especificas/
/*
Plugin Name: Plugin Selector
Plugin URI: https://ardid.com.ar
Description: Removes plugins in selected pages
Author: Anibal Ardid
Version: 1.0
Author URI: https://ardid.com.ar
*/
if (!is_admin()) {
add_filter( 'option_active_plugins', 'plugin_selector' );
function plugin_selector($plugins){
if(strpos($_SERVER['REQUEST_URI'], '/search/') === 0) {
// KK Star Ratings
$key = array_search( 'kk-star-ratings/index.php', $plugins );
if ( false !== $key ) { unset( $plugins[$key] ); }
// Shareaholic
$key = array_search( 'shareaholic/shareaholic.php', $plugins );
if ( false !== $key ) { unset( $plugins[$key] ); }
// Genesis Responsive Slider
$key = array_search( 'genesis-responsive-slider/genesis-responsive-slider.php', $plugins );
if ( false !== $key ) { unset( $plugins[$key] ); }
// Contextual Related Posts
$key = array_search( 'contextual-related-posts/contextual-related-posts.php', $plugins );
if ( false !== $key ) { unset( $plugins[$key] ); }
} elseif($_SERVER['REQUEST_URI'] === '/' || $_SERVER['REQUEST_URI'] === '') {
// KK Star Ratings
$key = array_search( 'kk-star-ratings/index.php', $plugins );
if ( false !== $key ) { unset( $plugins[$key] ); }
// Shareaholic
$key = array_search( 'shareaholic/shareaholic.php', $plugins );
if ( false !== $key ) { unset( $plugins[$key] ); }
}
return $plugins;
}
}
以上是关于php mu-plugin carga condicional插件的主要内容,如果未能解决你的问题,请参考以下文章
php WordPress mu-plugin概念证明可自动禁用开始抛出错误的插件。
php WP迁移DB Pro迁移后清除Elementor缓存 - 必须使用插件(mu-plugins)
php WP迁移DB Pro迁移后清除Elementor缓存 - 必须使用插件(mu-plugins)
php 在the_content()之前或之后添加HTML或Shortcode - WordPress mu-plugin
php Mu-plugin - [MarketPress]允许免费送货,如果购物车总额大于X金额,则根据指定的送货方式。
php Mu-plugin允许您在Marketpress中为指定的送货方式免费送货,如果购物车总数大于设定的最低限额,免费送货