WordPress filter hook · part of WordPress core
widget_pages_args
A WordPress core filter that 3 plugins also fire themselves, running on 10K+ sites between them.
“Filters the arguments for the WPLegalPages widget.”
How to use widget_pages_args
It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'widget_pages_args', function( $value, $instance ) {
// Change $value here.
return $value;
}, 10, 2 );Argument names come from Privacy Policy Generator, Terms & Conditions, GDPR, CCPA, Cookie Policy & Disclaimer Templates's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
3 plugins that fire widget_pages_args
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
Privacy Policy Generator, Terms & Conditions, GDPR, CCPA, Cookie Policy & Disclaimer Templates10,000+ installs
apply_filters( 'widget_pages_args', array( 'title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude, 'meta_key' => 'is_legal', 'meta_value' => 'yes', ), $instance )widgets/class-wp-widget-legal-pages.php:83 -
Private Suite60+ installs
apply_filters( 'widget_pages_args', array('post_status' => 'publish,private', 'title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude) )private-suite.php:155 -
JS Widgets10+ installs
apply_filters( 'widget_pages_args', array( 'sort_column' => $instance['sortby'], 'exclude' => $instance['exclude'], ) )core-adapter-widgets/pages/class.php:139
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.