1

Here's my scenario: I'm building a Wordpress backend that links two custom post types for an HR department: Job Listings and Applicants.

Job Listing posts are created manually by the HR admin. Applicant posts are auto-generated based on form submission data.

I've set up a bunch of custom columns and filter options for the HR admin to use in the admin dashboard, but there are a couple items I'm stuck on - and maybe aren't even possible to do with Wordpress.

  1. Without using a plug-in, can I sort posts out of the primary edit.php and into a submenu for that post type? For example, I want to hide archived Job Listings from the main display, but I want them to be available for duplication in the future. I'm setting the job's posting status through an ACF radio button: open, closed, or archived.
  2. Can I do the same thing for applicants, but base it off of the associated Job Listing's archived status?

I also started to create a submenu for archived applicants, hoping to make it based off of the job's status but it seems like I wouldn't be able to get the full query quite right. Here's what I have so far:

add_action( 'admin_menu', 'archivedapplicants_admin_menu' ); 
function archivedapplicants_admin_menu()
{ 
    add_submenu_page(
        'edit.php?post_type=applicant',
        'Archived Applicants',
        'Archived Applicants',
        'manage_options',
        'edit.php?post_type=applicant&listing-status=archive',
        NULL
); 
}

My CPT for the Job Listings is "joblisting", the ACF field is titled "select", the value should be "archive", and each Applicant post has a custom field of "job_applied_id" that is the post ID of the Job Listing record.

Update for clarity: My primary question here is how to customize the main edit.php index for a CPT to exclude posts with a certain custom field setting but when I think about both of the questions I posed, what I think I need to look into is how to build a new sub-page/sub-menu to do this, rather than building a sub-page to show all of the excluded posts.

closed as too broad by Mark Kaplun, Christine Cooper, Nathan Johnson, Jacob Peattie, Jack Johansson Mar 7 '18 at 16:30

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • pre_get_posts can be used to modify admin queries you can't achieve with query string arguments alone. – Milo Mar 5 '18 at 23:29
  • Can I do something based on something? sure you can, but that is all the answer you are likely to get with this amount of specific detail. At first glance there seems to be at least two different questions here 1. how to change the default display of the post listing, and 2. How to add a menu that will lead you a specific filtering. – Mark Kaplun Mar 6 '18 at 7:59
  • @MarkKaplun yes, there are two questions here - I realize I probably should have split them up, but they are related and this morning your comment helped me realize that I'm thinking about this wrong. I'm a solo dev and I had reached my limit for how much code monkeying I could do without someone else lending a helpful idea or to maybe understand what I was trying to do. So, thank you, I suppose, for inadvertently helping me think of an alternate solution. – pork-chop Mar 6 '18 at 14:40