true, 'label' => 'Vehicles', 'has_archive' => true, 'show_in_menu' => 'addressya', 'show_in_admin_bar' => false, 'supports' => array('thumbnail'), ); register_post_type('addressya_vehicle', $args); } public function register_meta_boxes() { add_meta_box( 'addressya-vehicle-metabox', 'Vehicle Data', array($this, 'meta_box'), 'addressya_vehicle', 'normal', 'high' ); } public function meta_box() { global $post; require_once ADDRESSYA_PLUGIN_PATH . 'includes/admin/views/meta-boxes/html-vehicle-add.php'; } public function save_vehicle_meta_data($post_id) { global $post, $wpdb; if ($post_id == null || empty($_POST)) { return; } if (!isset($_POST['post_type']) || 'addressya_vehicle' !== $_POST['post_type']) { return; } if (wp_is_post_revision($post_id)) { $post_id = wp_is_post_revision($post_id); } if (isset($_POST['addressya_vehicle_name'])) { update_post_meta($post->ID, 'addressya_vehicle_name', sanitize_text_field($_POST['addressya_vehicle_name'])); } $wpdb->update( $wpdb->posts, array('post_title' => sanitize_text_field($_POST['addressya_vehicle_name'])), array('ID' => $post_id) ); } public function edit_table_columns($columns) { $columns = array( 'addressya_vehicle_name' => 'Vehicle Username', ); return $columns; } public function manage_table_columns($column, $post_id) { switch ($column) { case 'addressya_vehicle_name': echo get_post_meta($post_id, 'addressya_vehicle_name', true); break; } } } new ADDRESSYA_Admin_Vehicle_Post;