Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#30536 closed defect (bug) (invalid)

Trying to filter show_advanced_plugins doesn't work correctly

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

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
10 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to 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.