0
votes

I am creating my own plugin in Wordpress. With register_post_type I can view my own posts. I also created a post status with register_post_status. When I go to the summary page I can see all posts and filter on the status.

The "problem": When I go to the summary page, I can see all posts and the filters. The "All" status is always selected on default, but I want to select my custom status on default. Is this possible? Or change the URL in the menu to post_status=&post_type= ? I am talking about the admin side.

Hope someone can help me, because I can't figure it out.

1
If the code you added to your question has fixed the issue, please add it as an answer instead, so that we know the question is answered - see Can I answer my own question?FluffyKitten

1 Answers

0
votes

I have fixed it with this code - it changes the url in the menu:

add_action( 'admin_menu', 'wpse_admin_menu', 100 );
function wpse_admin_menu()
{
  global $menu, $submenu;
  $parent = 'parent';

  if( !isset($submenu[$parent]) )
    return;

  foreach( $submenu[$parent] as $k => $d ){
      if( $d[0] == 'name' )
      {
          $submenu[$parent][$k][2] = 'edit.php?post_status=status&post_type=type';
          break;
      }
  }
}