apply_filters( ‘widget_pages_args’, array $args, array $instance )

Filters the arguments for the Pages widget.

Description

See also

Parameters

$argsarray
An array of arguments to retrieve the pages list.
$instancearray
Array of settings for the current widget.

Source

apply_filters(
	'widget_pages_args',
	array(
		'title_li'    => '',
		'echo'        => 0,
		'sort_column' => $sortby,
		'exclude'     => $exclude,
	),
	$instance
)

Changelog

VersionDescription
4.9.0Added the $instance parameter.
2.8.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    Example migrated from Codex:

    The following removes certain pages from displaying in the WordPress default Display Pages widget.

    add_filter( 'widget_pages_args', 'wp_list_pages_filter', 10, 1 );
    
    function wp_list_pages_filter($args, $instance) {
        global $secure_slug;
    
        $remove_secure = array($secure_slug); // or could be array(1,2,3,4)
        $args['exclude'] = implode( ',', $remove_secure );
        return $args;
    }

You must log in before being able to contribute a note or feedback.