Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // SHOW "publish" POSTS ONLY BY DEFAULT -----------------------------------------------------
- add_action( 'admin_menu', 'my_default_published' );
- function my_default_published(){
- global $submenu;
- // POSTS
- foreach( $submenu['edit.php'] as $key => $value ){
- if( in_array( 'edit.php', $value ) ){
- $submenu['edit.php'][ $key ][2] = 'edit.php?post_status=publish&post_type=post';
- }
- }
- // OTHER POST TYPES
- $cpt = array( 'my_cpt_1', 'my_cpt_2' ); // <--- remove or adapt the post types
- foreach( $cpt as $pt ){
- foreach( $submenu[ 'edit.php?post_type=' . $pt ] as $key => $value ){
- if( in_array( 'edit.php?post_type=' . $pt, $value ) ){
- $submenu[ 'edit.php?post_type='.$pt ][ $key ][2] = 'edit.php?post_status=publish&post_type=' . $pt;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement