The MU forums have moved to WordPress.org

remove_filter() is not working as expected... (3 posts)

  1. boindk
    Member
    Posted 16 years ago #

    Hi

    I have been working on a plugin to control blog space on a per blog basis.

    I have found this filter hook "check_upload_size" that controls space used on a blog. "check_upload_size" looks at the get_site_option("blog_upload_space" ) to check against available space set in the "mother" blog admin. This setting applies to all blogs, but all these things you probably know.

    My question is:

    When I try to remove filter "check_upload_size" like this remove_filter( 'wp_handle_upload_prefilter', 'check_upload_size'); and replace it with my own filter like this add_filter('wp_handle_upload_prefilter', 'check_space_pre') it does not work. The filter is not removed completely.

    What happens is this...

    I am able to add the filter add_filter('wp_handle_upload_prefilter', 'check_space_pre') and things in the function check_space_pre is executed. If any of the conditions defined in the function check_space_pre are not met the execution is halted by wp_die( $file[ 'error' ] . ' ' . __( 'Back' ) . '' ); just like the original one. I can then see the error message defined in the check_space_pre function so I know for sure the function is active and therebye have been added. But the thing is the function "check_upload_size" is still executed if the "check_space_pre" function is returning the $file after succesfull validation, how come?

    I know you can set priorities for these filters maybe that is the reason but I doubt it because in /wp_admin/includes/mu.php where "check_upload_size" is defined as function and added as filter add_filter( 'wp_handle_upload_prefilter', 'check_upload_size' ); no priority is set . I have tried various priorities, both for add_filter and remove_filter, but none of them seems to work.

    I have a tight schedule, so any help is appreciated.

  2. boindk
    Member
    Posted 16 years ago #

    Problem solved..

  3. alexandrehaguiar
    Member
    Posted 15 years ago #

    I having the same problem. How can i remove this filter?

About this Topic

  • Started 16 years ago by boindk
  • Latest reply from alexandrehaguiar