2

Most plugins try to hide the components of the edit.php screen on wp admin and replace it with meta boxes to create the needed layout and fields for the custom post type.

But this means that there is still unnecessary code on that edit.php page not used and increases the page load. Also, Not everything can be done using meta boxes.

Is there is a way where i can create my own edit.php page from scratch for my custom post type? maybe hide the custom post type UI and make a new admin page and use it to insert the custom posts or update it? is this possible on admin pages?

1

1 Answer 1

4

When you register the CPT set show_ui to false. For example:

$args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => false, // <-- here
    'show_in_menu' => true, 
    'query_var' => true,
    'rewrite' => array( 'slug' => 'book' ),
    'capability_type' => 'post',
    'has_archive' => true, 
    'hierarchical' => false,
    'menu_position' => null,
    'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
); 

You will now have to construct an interface for the CPT just as you'd construct one for a admin plugin page. You are not reconstructing or editing edit.php. Your interface will have a different address as given when you register the admin page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.