Skip to content

Instantly share code, notes, and snippets.

@ingozoell
Created August 31, 2016 14:33
Show Gist options
  • Save ingozoell/d086eeacf3b724e26c787f0e9d76e906 to your computer and use it in GitHub Desktop.
Save ingozoell/d086eeacf3b724e26c787f0e9d76e906 to your computer and use it in GitHub Desktop.
add_action( 'admin_menu', 'default_published_wpse_91299' );
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', 'product' );
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;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment