注册新的帖子类型会返回500错误

时间:2016-12-09 10:17:28

标签: wordpress

我是WordPress的新手,我想创建一个带有自定义分类的自定义帖子类型会话和slug“sessions”,我的代码出现500内部服务器错误,我在这里缺少什么?

function session_post_type(){
  $labels = array(
    'name' => 'Session',
    'singular_name' => 'Session',
    'add_new' => 'Add Item',
    'all_items' => 'All Items',
    'edit_item' => 'Edit Item',
    'view_item' => 'View Item',
    'search_item' => 'Search Item',
    'not_found' => 'No items found'       
  );
  $args = array(
    'labels' = $labels,
    'public' => true,
    'has_archive' => true,
    'taxonomies' => array('category', 'post_tag'),
    'menu_position' => 5,
    'exclude_from_search' => false
  );

  /*
   * now register the session type with slug 'sessions'
   */

  register_post_type('sessions',$args);
}

/*
 * the hook that will create the session type when the them is loaded (when 'init' is executed)
 */
 add_action( 'init', 'session_post_type' );

1 个答案:

答案 0 :(得分:2)

'labels' = $labels,=而不是=>