Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#30536 closed defect (bug) (invalid)

Trying to filter show_advanced_plugins doesn't work correctly

Reported by: jkmassel Owned by:
Priority: normal Milestone:
Component: Plugins Version: 4.0.1
Severity: normal Keywords:
Cc: Focuses: administration

Description

I have the following filter on show_advanced_plugins:

add_filter('show_advanced_plugins', function($true_or_false, $type){
	if($type == 'mustuse'){
		return false;
	}
			
	return true;
});

The problem is, $type is never passed to this function.

One (probably awful) way to fix it is to modify plugin.php, line 214:

$value = call_user_func_array($the_function, array_slice($args, 1, (int) $the_accepted_args));

Changing (int) $the_accepted_args to count($args) - 1 made it so $type was populated, but caused other warnings in the admin area, if that's helpful.

Change History (1)

#1 @dd32
12 years ago

  • Milestone Awaiting Review
  • Resolution → invalid
  • Status new → closed

You need to pass the $priority and $number_of_args parameters:
add_filter( 'show_advanced_plugins', function($true_or_false, $type){..}, 10, 2 );

Note: See TracTickets for help on using tickets.