Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save chuckreynolds/0fa3af52462b5929e74d to your computer and use it in GitHub Desktop.
Save chuckreynolds/0fa3af52462b5929e74d to your computer and use it in GitHub Desktop.
This will make the WordPress admin menu link to posts and pages but with the Published filter active by default.
<?php
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