Skip to content

Instantly share code, notes, and snippets.

@jamigibbs
Last active October 28, 2017 09:56
Show Gist options
  • Save jamigibbs/3ffe6a77fbecaaa88d34f2d551e9dd8f to your computer and use it in GitHub Desktop.
Save jamigibbs/3ffe6a77fbecaaa88d34f2d551e9dd8f to your computer and use it in GitHub Desktop.
<?php
function my_theme_remove_redux_framework_notification() {
if ( class_exists('ReduxFrameworkPlugin') ) {
remove_filter( 'plugin_row_meta', array( ReduxFrameworkPlugin::get_instance(), 'plugin_metalinks'), null, 2 );
remove_action('admin_notices', array( ReduxFrameworkPlugin::get_instance(), 'admin_notices' ) );
}
}
add_action('init', 'my_theme_remove_redux_framework_notification');
@ahmadworks
Copy link

I just got soft reject and one of reasons was "Remove all unrelated Redux items" this code will not remove Redux items if Debug = true, the only way to remove them while debug set to true is to set 'forced_dev_mode_off' => true, and this one is not allowed.

@jamigibbs
Copy link
Author

jamigibbs commented Jul 22, 2016

If those solutions aren't working for some other unnecessary notices that are coming up (or Redux isn't proving the filters you need), then you may want to consider enqueueing an admin stylesheet:

function my_theme_admin_style() {
  wp_enqueue_style('admin-styles', get_template_directory_uri().'/admin.css');
}
add_action('admin_enqueue_scripts', 'my_theme_admin_style');
/* ../admin.css */

.redux-message { display: none; }

@ahmadworks
Copy link

I already uploaded the theme again with the first solution which you provided in the message, you can check the upload on my account, my envato username is ahmadworks

@jamigibbs
Copy link
Author

See also:
https://gist.github.com/jamigibbs/8776e839ce0d9edd685f2100a20b1769

if ( ! function_exists( 'theme_name_remove_anonymous_object_filter' ) ){
    /**
     * Remove an anonymous object filter.
     *
     * @param  string $tag    Hook name.
     * @param  string $class  Class name
     * @param  string $method Method name
     * @return void
     */
    function theme_name_remove_anonymous_object_filter( $tag, $class, $method ) {
        $filters = $GLOBALS['wp_filter'][ $tag ];

        if ( empty ( $filters ) ) {
          return;
        }

        foreach ( $filters as $priority => $filter ) {
            foreach ( $filter as $identifier => $function ) {
                if ( is_array( $function)
                    and is_a( $function['function'][0], $class )
                    and $method === $function['function'][1] ) {

                    remove_filter(
                        $tag,
                        array ( $function['function'][0], $method ),
                        $priority
                    );
                }
            }
        }
    }
}

function theme_name_remove_redux_framework_admin_notices_action() {
    theme_name_remove_anonymous_object_filter(
        'admin_notices',
        'ReduxFramework',
        '_admin_notices'
    );
}
add_action('admin_init', 'theme_name_remove_redux_framework_admin_notices_action');

@blicca
Copy link

blicca commented Oct 28, 2017

this code https://gist.github.com/jamigibbs/8776e839ce0d9edd685f2100a20b1769 is giving fatal error on somehosting. Users can not activate theme.

"Cannot use object of type Closure as array" (line is ... and is_a ( $function...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment