WordPress 技巧:如何从 WordPress 页面菜单中移除特定页面
从 wp_list_pages()
中生成的页面菜单中移除特定的页面是非常简单的,只需要把下面代码加入到主题的 functions.php
文件中:
// add page ids to the exclude list
function my_banned_pages( $exclude_array ) {
return array_merge( $exclude_array, array( 4, 17 ) );
}
add_filter( 'wp_list_pages_excludes', 'my_banned_pages' );
只需要把数组中的数字改成你要移除页面 ID 就可。
©我爱水煮鱼,本站推荐使用的主机:阿里云,国外主机建议使用BlueHost。
本站长期承接 WordPress 优化和建站业务,请联系微信:「chenduopapa」。