What does add_action('init', 'register_wp_questions');
do in your plugin. At this stage this is your problem. You are hooking a function to init
that does not exist, thus giving you an error.
I suppose that you need to register and hook your CPT to the init
hook. You should actually put all that code in a function and then add it to the init
hook. Your code should be
<?php
/**
* Plugin Name: Name Of The Plugin
* Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
* Description: A brief description of the Plugin.
* Version: The Plugin's Version Number, e.g.: 1.0
* Author: Name Of The Plugin Author
* Author URI: http://URI_Of_The_Plugin_Author
* License: A "Slug" license name e.g. GPL2
*/
add_action('init', 'register_wp_questions');
function register_wp_questions() {
$labels = array(
'name' => __( 'Questions', 'wp_question' ),
'singular_name' => __( 'Question', 'wp_question' ),
'add_new' => __( 'Add New', 'wp_question' ),
'add_new_item' => __( 'Add New Question', 'wp_question' ),
'edit_item' => __( 'Edit Questions', 'wp_question' ),
'new_item' => __( 'New Question', 'wp_question' ),
'view_item' => __( 'View Question', 'wp_question' ),
'search_items' => __( 'Search Questions', 'wp_question' ),
'not_found' => __( 'No Questions found', 'wp_question' ),
'not_found_in_trash' => __( 'No Questions found in Trash','wp_question' ),
'parent_item_colon' => __( 'Parent Question:', 'wp_question'),
'menu_name' => __( 'Questions', 'wp_question' )
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'description' => __( 'Questions and Answers', 'wp_question' ),
'supports' => array( 'title', 'editor', 'comments' ),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => true,
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'rewrite' => true,
'capability_type' => true
);
register_post_type ('wp_question', $args);
}
?>