最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

include specific Pages to wp_list_pages with filter

programmeradmin0浏览0评论

How can i make a simple filter to display only specific pages (include instead of exclude) as an output to wordpress pages widget?

I made this code , but its not working

function specific_pages($output) {

$args = array(
    'include'  => array(147,12,32),
);
$output = get_posts($args);



return $output;
 }
add_filter('wp_list_pages', 'specific_pages');

How can i make a simple filter to display only specific pages (include instead of exclude) as an output to wordpress pages widget?

I made this code , but its not working

function specific_pages($output) {

$args = array(
    'include'  => array(147,12,32),
);
$output = get_posts($args);



return $output;
 }
add_filter('wp_list_pages', 'specific_pages');
Share Improve this question asked May 23, 2020 at 16:59 HonolulumanHonoluluman 351 silver badge13 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

the corresponding hook would be https://developer.wordpress/reference/hooks/widget_pages_args/

example code:

add_filter( 'widget_pages_args','include_special_pages' );
function include_special_pages( $args ) {
  $args['include'] = array( 147, 12, 32 );
  return $args;
}
发布评论

评论列表(0)

  1. 暂无评论