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”.
add_action('admin_head-edit.php','wpse_54054_remove_template');
function wpse_54054_remove_template()
{
global $wp_themes,$current_screen;
if('edit-page' != $current_screen->id)
return;
get_themes();
$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] );
}