Skip Navigation

[Resolved] Remove ‘Content Template’ from sidebar in edit page

This thread is resolved. Here is a description of the problem and solution.

Problem:
Remove 'Content Template' and 'Template Layout' widgets/metabox for certain CPT in admin screen.

Solution:
Please add this code in your theme’s or child theme’s functions.php file:

 
add_action( 'admin_head', 'wpv_custom_admin_head', 20);
function wpv_custom_admin_head() {
    remove_meta_box( 'wpddl_template', 'book', 'side' ); // replace book with your CPT slug
    remove_meta_box( 'views_template', 'book', 'side' ); // replace book with your CPT slug
}

==> Whereas 'book' should be replaced with your CPT slug.

Relevant Documentation:
https://codex.wordpress.org/Function_Reference/remove_meta_box

0% of people find this useful.

This support ticket is created 6 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 3 replies, has 3 voices.

Last updated by derekD-2 6 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#675794
content-template.jpg

I am trying to: Remove the 'Content Template' metabox from the sidebar in when editing a page.

Link to a page where the issue can be seen:

I expected to see: No, Content Template metabox

Instead, I got: I still see the Content Template metabox on pages, but it has been removed from posts.

I found this page: https://toolset.com/forums/topic/remove-content-template-and-template-layout-widgets-for-editors/ which is supposed to remove the link from pages and posts. It has removed the Content Template box from Posts but not Pages.

This is the code that I used:
// Remove Toolset Content Template meta box
add_action( 'admin_head', 'realtor0_wpv_custom_admin_head', 20);
function realtor0_wpv_custom_admin_head() {
remove_meta_box( 'wpddl_template', 'post', 'side' );
remove_meta_box( 'wpddl_template', 'page', 'side' );
}

You can see that the box is still showing in the image below.

#675814

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Try adding this

    remove_meta_box( 'views_template', 'page', 'side' ); // replace book with your CPT slug

Thanks,
Shane

#676184

Thank you.
That fixed the issue.

#1606029