I'm helping a non-profit to keep a site working (made by different people over the years) and we recently upgraded WP from the latest 4.x version to 5.2.4 . A few days ago I found an issue with a custom post type that is registered in a home grown plugin.
The error is triggered when I navigate to the add new page for the custom post type talk
or when I edit and click update in an existing talk
. There are no messages logged on the WP debug log or email to the WP admin email address.
The code that registers the custom type is (simplified slightly)
function wdm_talk_post_type() {
$labels = array(
'name' => _x( 'Talks', 'post type general name', 'wdm_teacher' ),
'singular_name' => _x( 'Talk', 'post type singular name', 'wdm_teacher' ),
'menu_name' => _x( 'Talks', 'admin menu', 'wdm_teacher' ),
'name_admin_bar' => _x( 'Talk', 'add new on admin bar', 'wdm_teacher' ),
'add_new' => _x( 'Add New', 'teacher', 'wdm_teacher' ),
'add_new_item' => __( 'Add New Talk', 'wdm_teacher' ),
'new_item' => __( 'New Talk', 'wdm_teacher' ),
'edit_item' => __( 'Edit Talk', 'wdm_teacher' ),
'view_item' => __( 'View Talk', 'wdm_teacher' ),
'all_items' => __( 'All Talks', 'wdm_teacher' ),
'search_items' => __( 'Search Talks', 'wdm_teacher' ),
'parent_item_colon' => __( 'Parent Talks:', 'wdm_teacher' ),
'not_found' => __( 'No teachers found.', 'wdm_teacher' ),
'not_found_in_trash' => __( 'No teachers found in Trash.', 'wdm_teacher' )
);
$args = array(
'labels' => $labels,
'description' => __( 'Description.', 'wdm_teacher' ),
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'talk' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
);
register_post_type( 'talk', $args );
}
add_action( 'add_meta_boxes', 'wdm_talk_meta_box' );
function wdm_talk_post_save($post_id,$post){
// I removed the body of the function, to test this bug.
// The original code stores some custom fields
}
add_action('save_post_talk','wdm_talk_post_save');
If I comment the line that adds the action save_post_talk
, the site works fine, but the logic to store the custom fields is not triggered.
Can someone spot the issue? I'm not a wordpress guru (but do have plenty of experience programming in other languages).
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744891337a4599432.html
评论列表(0条)