I was looking for a way to hide the parent theme's templates and found this answer which works perfectly to remove the parent templates from the pages edit screen - How to *remove* a parent theme page template from a child theme?.

I don't want the parent templates that I've removed to show anywhere in admin, however they still appear in the dropdown box labeled "Template" on WP Admin > Pages > All Pages in the "QUICK EDIT" section. Does anyone know of a way to do this?

1 Answer 1


Answer remade. The original was a wild idea...

The solution is the same as the one posted by Rarst in the question linked
How to *remove* a parent theme page template from a child theme?

Difference being the admin_head hook.
And a check for only running in edit-page and not in edit-post or edit-custom_post_type, as all these cases are fired by admin_head-edit.php.

The parent is "Twenty Eleven" and the child is called "Twenty Twelve".


function wpse_54054_remove_template() 
    global $wp_themes,$current_screen;

    if('edit-page' != $current_screen->id)


    $templates = &$wp_themes['Twenty Twelve']['Template Files'];

    $template1 = trailingslashit( TEMPLATEPATH ).'showcase.php';
    $template2 = trailingslashit( TEMPLATEPATH ).'sidebar-page.php';

    $key1 = array_search($template1, $templates);
    $key2 = array_search($template2, $templates);

    unset( $templates[$key1], $templates[$key2] );
  • Thanks for your reply, @brasofilo. Looks like I may need to go for an easier solution: Override the parent theme's templates. I wanted to show only the child theme's templates for naming reasons. That is, instead of template-2, template-3, etc. I wanted to use more descriptive names customized to the website.
    – user16689
    Jun 3, 2012 at 23:57
  • @user16689 - geeee... I'm always thinking on brute force jQuery solutions... sorry... amending the answer in a sec...
    – brasofilo
    Jun 4, 2012 at 0:18
  • Has anyone tested this answer on 3.4+? I'm not getting it to working, and from poking around a bit, it seems that WordPress changes the way themes were handled a lot. I think the templates are now private and in an object, breaking the above script. And sadly, my PHP skillz leave me stuck at that observation.
    – mrwweb
    Jul 7, 2012 at 19:27

Your Answer

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

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