Apply pre_get_posts to specific custom post type in the admin area

The function you are looking for is get_current_screen(). To check if you are on a specific custom post type page, do as follows: $screen = get_current_screen(); if ( $screen->post_type == ‘custom_job’ ) { // We are on custom_job post type, good to go } Now, if you visit edit.php?post_type=custom_job, this conditional will return true, which … Read more

When post is Published, insert into custom table a number – custom post type

Take a look at WordPress’ Post Status Transitions hooks: https://codex.wordpress.org/Post_Status_Transitions If you’ve added proper debugging (so that you die at the top of your hooked function) it sounds like you’re not hooking into the right action. Since you’re adding some meta and checking for it to see if you should run again, you could hook … Read more

Previous/Next custom post links within custom taxonomy

I managed to solve this, with some steering in the right direction in the comments under my question, by specifying different templates for different taxonomy terms using single-show.php to divert as follows: if ( have_posts() ) { the_post(); rewind_posts(); } if (has_term(‘current’, ‘show_status’)) { include(TEMPLATEPATH . ‘/single-show-current.php’); } elseif (has_term(‘past’, ‘show_status’)) { include(TEMPLATEPATH . ‘/single-show-past.php’); … Read more

Single taxonomy for different custom post types

I think this is what you are searching for… You must use both post_type and tax_query to filter your query $query = new WP_Query( array( ‘post_type’ => ‘books’, // name of post type. ‘tax_query’ => array( array( ‘taxonomy’ => ‘fiction’, // taxonomy name ) ) ) ); while ( $query->have_posts() ) : $query->the_post(); // do … Read more