Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
This will make the WordPress admin menu link to posts and pages but with the Published filter active by default.
add_action ( 'admin_menu', 'rkv_filter_admin_published_default' );
function rkv_filter_admin_published_default() {
// call global submenu item
global $submenu;
// edit main link for posts
$submenu['edit.php'][5][2] = 'edit.php?post_status=publish';
// edit main link for pages
$submenu['edit.php?post_type=page'][5][2] = 'edit.php?post_type=page&post_status=publish';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment