admin管理员组文章数量:1336293
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
1 Answer
Reset to default 1the 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;
}
本文标签: include specific Pages to wplistpages with filter
版权声明:本文标题:include specific Pages to wp_list_pages with filter 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742406268a2468881.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论