I am using the documentation here to create custom code to include the slug of the post in the admin columns.
https://docs.metabox.io/extensions/mb-admin-columns/#custom-admin-columns
The first error I get is:
PHP Fatal error: Uncaught Error: Class "MBAC\Post" not found
What am I missing?
I am running Metabox 5.10.3 and AIO 1.30.5
<div>
class Prefix_Custom_Admin_Columns extends \MBAC\Post {
public function columns( $columns ) {
$columns = parent::columns( $columns );
$position = 'after';
$target = 'title';
$this->add( $columns, 'post_name', 'Slug', $position, $target );
// Add more if you want
return $columns;
}
public function show( $column, $post_id ) {
switch ( $column ) {
case 'post_name':
echo $post->post_name;;
break;
// More columns
}
}
}
</div>
<div>
Here is the function:
add_action( 'admin_init', 'prefix_add_custom_columns', 20 );
function prefix_add_custom_columns() {
require_once 'custom.php';
$post_type = 'post';
new Prefix_Custom_Admin_Columns( $post_type, [] );
}
</div>