Skip to content

Instantly share code, notes, and snippets.



Created Jul 23, 2016
What would you like to do?
MB Admin Columns - Add Custom Non-Meta Column
class Prefix_Custom_Admin_Columns extends MB_Admin_Columns_Post {
public function columns( $columns ) {
$columns = parent::columns( $columns );
* Add more column in a specific position
* @param string $position New column position. Empty to not specify the position. Could be 'before', 'after' or 'replace'
* @param string $target The target column. Used with combination with $position
$position = '';
$target = '';
$this->add( $columns, 'column_id', 'Column Title', $position, $target );
// Add more if you want
return $columns;
public function show( $column, $post_id ) {
switch ( $column ) {
case 'column_id':
echo 'Column content';
// More columns
add_action( 'admin_init', 'prefix_add_custom_columns', 20 );
function prefix_add_custom_columns() {
require_once 'custom.php';
new Prefix_Custom_Admin_Columns( 'post', array() );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.