WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#14658 closed defect (bug) (invalid)

image_downsize filter always gets only false argument, other are not passed

Reported by: mariokostelac Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0.1
Component: General Keywords: image_downsize
Focuses: Cc:

Description

I'm in progress of developing some theme for WordPress and realized that:

add_filter( 'image_downsize', 'mk_image_downsize' );
	function mk_image_downsize()
	{
		var_dump( func_get_args() );
	}

always prints false. image_downsize returns right values, but arguments are not passed to the filter functions.
I think this is caused by line 142 in wp-includes/media.php file.

if ( $out = apply_filters('image_downsize', false, $id, $size) )

False is passed to filter function, but $id and $size are not.

Change History (2)

comment:1 nacin4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

If you want more than one argument passed to your callback, you need to tell WordPress in your add_filter() call.

add_filter( $filter, $callback, $priority = 10, $number_of_args = 1 );

comment:2 mariokostelac4 years ago

Andew, thank you a lot, I'm sry for posting this as a bug.

Note: See TracTickets for help on using tickets.