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

plugin development - Make visible page only in the trash

programmeradmin0浏览0评论

i'm working on a plugin that generate some pages and they are hidden to User in the wp admin. But i had not choise to do a radical action and hidden ALL pages created from my plugin. The ideal for me is hidden the pages from WP admin in "pages" but make them visible in "Trash". I make this function to hide pages:

add_filter( 'parse_query', 'mic_hide_pages_in_wp_admin' );
function mic_hide_pages_in_wp_admin($query) {
    global $pagenow,$post_type,$post_status;
    $result = mic_get_all_id();
    if (is_admin() && $pagenow=='edit.php' && $post_type =='page') {
        $query->query_vars['post__not_in'] = $result;
    } 
}

mic_get_all_id() is my function that get all ID of generated pages for hide them. Now, how can i make visible all this page when some of them are put in the trash?

发布评论

评论列表(0)

  1. 暂无评论