Problem registering a custom meta box

Hi I’m struggling with registering a custom meta box. I have registered post types and a taxonomy as follows:

add_action(‘init’, ‘gws_lt_register_cpts’);
//register custom post types
function gws_lt_register_cpts() {
//request labels
$gws_lt_req_labels = array(
‘name’ => ‘Requests’,
‘singular_name’ => ‘Request’,
‘add_new’ => ‘Add New Request’,
‘add_new_item’ => ‘Add New Request’,
‘edit_item’ => ‘Edit Request’,
‘new_item’ => ‘New Request’,
‘all_items’ => ‘All Requests’,
‘view_item’ => ‘View Request’,
‘view_items’ => ‘View Requests’,
‘search_items’ => ‘Search Requests’,
‘not_found’ => ‘No Requests found’,
‘not_found_in_trash’ => ‘No Requests found in Trash’,
‘parent_item_colon’ => ”,
‘archives’ => ‘Request Archives’,
‘attributes’ => ‘Request Attributes’,
‘insert_into_item’ => ‘Insert into Request’,
‘uploaded_to_this_item’ => ‘Uploaded to this Request’
);

//request arguments
$gws_lt_req_args = array(
‘labels’ => $gws_lt_req_labels,
‘public’ => true,
‘supports’ => array(‘title’, ‘editor’, ‘thumbnail’),
‘has_archive’ => true,
‘taxonomies’ => array(‘offer_categories’)
);

//register requests
register_post_type(‘request’, $gws_lt_req_args );

//offer labels
$gws_lt_off_labels = array(
‘name’ => ‘Offers’,
‘singular_name’ => ‘Offer’,
‘add_new’ => ‘Add New Offer’,
‘add_new_item’ => ‘Add New Offer’,
‘edit_item’ => ‘Edit Offer’,
‘new_item’ => ‘New Offer’,
‘all_items’ => ‘All Offers’,
‘view_item’ => ‘View Offer’,
‘view_items’ => ‘View Offers’,
‘search_items’ => ‘Search Offers’,
‘not_found’ => ‘No Offers found’,
‘not_found_in_trash’ => ‘No Offers found in Trash’,
‘parent_item_colon’ => ”,
‘archives’ => ‘Offer Archives’,
‘attributes’ => ‘Offer Attributes’,
‘insert_into_item’ => ‘Insert into Offer’,
‘uploaded_to_this_item’ => ‘Uploaded to this Offer’
);

//offer arguments
$gws_lt_off_args = array(
‘labels’ => $gws_lt_off_labels,
‘public’ => true,
‘supports’ => array(‘title’, ‘editor’, ‘thumbnail’),
‘has_archive’ => true,
‘taxonomies’ => array(‘offer_categories’)
);

//register offers
register_post_type(‘offer’, $gws_lt_off_args );

//transaction labels
$gws_lt_trans_labels = array(
‘name’ => ‘Transactions’,
‘singular_name’ => ‘Transaction’,
‘add_new’ => ‘Add New Transaction’,
‘add_new_item’ => ‘Add New Transaction’,
‘edit_item’ => ‘Edit Transaction’,
‘new_item’ => ‘New Transaction’,
‘all_items’ => ‘All Transactions’,
‘view_item’ => ‘View Transaction’,
‘view_items’ => ‘View Transactions’,
‘search_items’ => ‘Search Transactions’,
‘not_found’ => ‘No Transactions found’,
‘not_found_in_trash’ => ‘No Transactions found in Trash’,
‘parent_item_colon’ => ”,
‘archives’ => ‘Transaction Archives’,
‘attributes’ => ‘Transaction Attributes’,
‘insert_into_item’ => ‘Insert into Transaction’,
‘uploaded_to_this_item’ => ‘Uploaded to this Transaction’
);

//transaction arguments
$gws_lt_trans_args = array(
‘labels’ => $gws_lt_trans_labels,
‘public’ => true,
‘supports’ => array(‘title’, ‘editor’),
‘has_archive’ => true
);

//register transactions
register_post_type(‘transaction’, $gws_lt_trans_args);
}

//register taxonomies
add_action(‘init’,’gws_lt_reg_tax’);

function gws_lt_reg_tax() {

$tax_args = array (‘hierarchical’ => true);

register_taxonomy(‘offer_categories’, array(‘offer’, ‘request’), $tax_args);

}

But now every time I try to register the meta box, I get a 500 error on the website. Can anyone see what I’m doing wrong?

add_action(‘add_meta_boxes_transaction’, ‘gws_lt_add_meta’);
function gws_lt_add_meta() {
//create a custom meta box
add_meta_box(‘gws-lt-trans-meta’, ‘Transaction Data’, ‘gws_lt_trans_meta_function’);
}

Read more here:: Problem registering a custom meta box

Leave a Reply

Your email address will not be published. Required fields are marked *