widget_posts_args хук-фильтр . WP 3.4.0
Filters the arguments for the Recent Posts widget.
Использование
add_filter( 'widget_posts_args', 'filter_function_name_8830', 10, 2 ); function filter_function_name_8830( $args, $instance ){ // filter... return $args; }
- $args(массив)
- An array of arguments used to retrieve the recent posts.
- $instance(массив)
- Array of settings for the current widget.
Список изменений
С версии 3.4.0 | Введена. |
С версии 4.9.0 | Added the $instance parameter. |
Где вызывается хук
wp-includes/widgets/class-wp-widget-recent-posts.php 72-81
apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, ), $instance )