我刚刚将我的WP站点从一台服务器移动到另一台服务器,我的自定义帖子类型插件导致以下错误:
Warning: call\\u user\\u func\\u array()要求参数1是有效的回调,在/var/sites/*/****中找不到函数“my\\u admin”,或函数名无效。com/public\\u html/wp-includes/plugin。php在线496
我的自定义帖子类型代码如下:
function all_post_types() {
create_video_camera();
create_stills_camera();
create_lens();
create_light();
create_sound();
create_aerial();
}
add_action( \'init\', \'all_post_types\' );
function create_video_camera() {
$labels = array(
\'name\' => _x( \'Video Cameras\', \'Post Type General Name\', \'******\' ),
\'singular_name\' => _x( \'Video Camera\', \'Post Type Singular Name\', \'******\' ),
\'menu_name\' => __( \'Video Camera\', \'******\' ),
\'name_admin_bar\' => __( \'Video Camera\', \'******\' ),
\'parent_item_colon\' => __( \'Parent Video Camera:\', \'******\' ),
\'all_items\' => __( \'All Video Cameras\', \'******\' ),
\'add_new_item\' => __( \'Add New Video Camera\', \'******\' ),
\'add_new\' => __( \'Add New\', \'******\' ),
\'new_item\' => __( \'New Video Camera\', \'******\' ),
\'edit_item\' => __( \'Edit Video Camera\', \'******\' ),
\'update_item\' => __( \'Update Video Camera\', \'******\' ),
\'view_item\' => __( \'View Video Camera\', \'******\' ),
\'search_items\' => __( \'Search Video Camera\', \'******\' ),
\'not_found\' => __( \'Not found\', \'******\' ),
\'not_found_in_trash\' => __( \'Not found in Trash\', \'******\' ),
);
$args = array(
\'label\' => __( \'video_camera\', \'******\' ),
\'description\' => __( \'Video Camera Template\', \'******\' ),
\'labels\' => $labels,
\'supports\' => array( \'title\', \'editor\', \'thumbnail\', ),
\'taxonomies\' => array( \'category\', \'post_tag\' ),
\'hierarchical\' => false,
\'public\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'menu_position\' => 25,
\'menu_icon\' => \'dashicons-video-alt\',
\'show_in_admin_bar\' => true,
\'show_in_nav_menus\' => true,
\'can_export\' => true,
\'has_archive\' => true,
\'exclude_from_search\' => false,
\'publicly_queryable\' => true,
\'capability_type\' => \'post\',
);
register_post_type( \'video_camera\', $args );
}
其他register\\u post\\u类型的函数基本相似。
这一切都在旧服务器上运行得很好,但现在我发现了错误。我尝试过其他解决方案,但没有成功。
提前感谢:)