Find a way to show the "Submission" status of the CF7 Submissions submenu by default (instead of "All")
Opened this issue · 0 comments
chrisblakley commented
I want to find a way to make this the default when viewing CF7 form submissions:
This code works to modify the submenu slug to link to the Submissions status:
add_action('admin_menu', function(){
global $submenu;
if ( isset($submenu) && !empty($submenu) ){ //Check if $submenu is set and not empty
foreach ( $submenu as $parent_slug => &$submenus ){ //Loop through each top-level menu item by reference
if ( is_array($submenus) && !empty($submenus) ){ //Check if there are submenus for the current top-level menu item
foreach ($submenus as &$submenu_item){ //Loop through each submenu item by reference
if ( $submenu_item[2] == 'edit.php?post_type=nebula_cf7_submits' ){
$submenu_item[2] = 'edit.php?post_status=submission&post_type=nebula_cf7_submits'; //Modify the reference to it updates globally
}
}
}
}
}
});
However, the Contact Form 7 parent menu does not stay open when this is modified this way and I can't find a way to keep it open...
JavaScript is not an acceptable solution to this.
If I find a way to do that, I would then modify the custom post statuses of "Invalid" and "Spam" to allow them to appear in the "All" list (via /libs/Functions.php).