Created
September 28, 2016 20:41
-
-
Save ingozoell/fd26ff293f70d3461e45e81f7bb0a310 to your computer and use it in GitHub Desktop.
Wordpress: Redirect to Published Posts (Backend)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function default_published_wpse_91299() | |
{ | |
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( 'page', 'lehrer', 'aussteller' ,'partnerlogos' ); | |
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; | |
} | |
} | |
} | |
} | |
add_action( 'admin_menu', 'default_published_wpse_91299' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment