1

すべての投稿とページで実行されているプラ​​グインがあり、サンキューページ用に作成したカスタム テンプレートのコンテンツからプラグインを削除したいと考えています。

コンテンツに追加されているすべてのフィルターを印刷しました。参照したいフィルターは次のとおりです

[18de263ad73c07944f622a52d10d6e0ewpsocialite_filter_content] => Array
            (
                [function] => Array
                    (
                        [0] => wpsocialite Object
                            (
                                [options:private] => 
                            )

                        [1] => wpsocialite_filter_content
                    )

                [accepted_args] => 1
            )

    )

私は多くの異なる仲間を試しましたが、うまくいきません。functions.php の最終的なコードを次のようにしたいと思います

<?php if(is_page_template(thank-you.php)){
   remove_filter('the_content', 'wpsocialite_filter_content');
}

主な問題は、フィルターが Class Object によって追加されていることです。ここにそれを追加するコードがあります

if (!class_exists("wpsocialite")) {

class wpsocialite {
    public static $instance;
    private $options;

    public function WPSocialite() {
        $this->__construct();
    }

    function __construct() {
        self::$instance = $this;

        add_action(     'init',                     array( $this, 'init'                            ) );
        add_action(     'wp_footer',                array( $this, 'wpsocialite_localize_script'     ), 20);

        add_action(     'admin_init',               array( $this, 'admin_init'                      ) );
        add_action(     'admin_footer',             array( $this, 'admin_footer'                    ), 20);

        add_filter(     'body_class',               array( $this, 'wpsocialite_body_class'          ) );
        add_filter(     'the_content',              array( $this, 'wpsocialite_filter_content'      ) );
        add_filter(     'mce_external_plugins',     array( $this, 'wpsocialite_shortcode_plugin'    ) );
        add_filter(     'mce_buttons',              array( $this, 'wpsocialite_shortcode_button'    ) );
        add_filter(     'plugin_action_links',      array( $this, 'wpsocialite_settings_link'       ), 10, 2 );
        add_shortcode(  'wpsocialite',              array( $this, 'wpsocialite_shortcode'           ) );

        if( get_option( 'wpsocialite_excerpt' ) == 1 ){
            add_filter( 'the_excerpt',              array( $this, 'wpsocialite_filter_content'      ) );
        }

    } // __construct

それを参照して削除する方法は?

4

4 に答える 4

0

あなたはこのようなことを試すことができます、それは私のために働いた:

if ( class_exists( 'YITH_WC_Save_For_Later_Premium' ) ) {
    $yith_wc_save_for_later_premium = YITH_WC_Save_For_Later_Premium::get_instance(); /* <-- this is the key */
    remove_filter( 'woocommerce_cart_item_name', array( $yith_wc_save_for_later_premium, 'print_add_link_in_list'), 20 );
}
于 2016-12-16T22:28:15.647 に答える