Blog - Latest News

How to add new tab to admin list of posts and handle result list

  add_action(‘views_edit-post’,’remove_edit_post_views’);function remove_edit_post_views( $views ){ $views[‘pre’]='<a href=”‘.admin_url().’edit.php?pre=pre”>My Special Posts</a>’;return $views;} add_action(‘pre_get_posts’,’my_special_list’);function my_special_list( $q ){ $scr = get_current_screen();if( is_admin()&&( $scr->base===’edit’)&& $q->is_main_query()){// To target only a post type uncomment following line and adjust post type name// if ( $scr->post_type !== ‘post’ ) return;// if you change the link in function above adjust next line accordingly $pre = […]

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *