Skip Navigation

[Résolu] Remove ‘Content Template’ from sidebar in edit page

Ce fil est résolu. Voici une description du problème et la solution proposée.

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 Il y a 6 années et 7 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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)

Marqué : 

Ce sujet contient 3 réponses, a 3 voix.

Dernière mise à jour par derekD-2 Il y a 6 années et 7 mois.

Assisté par: Shane.

Auteur
Publications
#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

Les langues: Anglais (English )

Fuseau horaire: 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