How to Debug the ‘save_post’ Action?

Your code works just fine on my end. So, I’d say your problem is elsewhere. Troubleshooting guide. You can use standard debugging or FirePHP. I also use the following for cases where FirePHP doesn’t display information, i.e., save_post. function my_log( $msg, $title=”” ) { $error_dir=”/Applications/MAMP/logs/php_error.log”; $date = date( ‘d.m.Y h:i:s’ ); $msg = print_r( $msg, … Read more

Custom sortable columns ordered by meta-value?

It’s because you are checking ‘event_date’ == $vars[‘event_date’] not ‘event_date’ == $vars[‘orderby]. But don’t use the request filter. Instead: add_action( ‘pre_get_posts’, ‘event_column_orderby’ ); function event_column_orderby( $query ) { if( ! is_admin() ) return; $orderby = $query->get( ‘orderby’); if( ‘event_date’ == $orderby ) { $query->set(‘meta_key’,’_wr_event_date’); $query->set(‘orderby’,’meta_value_num’); } } … and don’t manually set the order as … Read more

Why does my custom taxonomy show a total count across all post types

There is currently a trac ticket on the fact that taxonomy counts are global (include all post types). Related trac ticket. To fix this you can remove the column and add your own using the manage_edit-{$taxonomy}_columns filter: add_filter(‘manage_edit-season_columns’,’my_season_columns’); function my_season_columns($columns){ unset($columns[‘posts’]); $columns[‘cpt_count’] = ‘Races’; return $columns; } You then tell WordPress what to fill this … Read more

Displaying category archive of custom post types

You can force use of your template for categories with the category_template filter: function wpa57439_category_template( $templates=”” ){ if( !is_array( $templates ) && !empty( $templates ) ) { $templates = locate_template( array( ‘archive-actors.php’, $templates ), false ); } elseif( empty( $templates ) ) { $templates = locate_template( ‘archive-actors.php’, false ); } else { $new_template = locate_template( … Read more