WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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] );
share|improve this answer
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 '12 at 23:57
@user16689 - geeee... I'm always thinking on brute force jQuery solutions... sorry... amending the answer in a sec... – brasofilo Jun 4 '12 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 '12 at 19:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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