I am using the child theme and have renamed it to the new theme name. However, the parent theme is still viewable in the admin area with the original theme name. How do I hide the parent theme? Thanks.

  • Just a simple plugin that add a little bid javascript source to hide the markup for this parent. Simple, but useful. Alternative use Adminimize plugin to do this, allow to create custom rule to hide areas. – bueltge May 20 '15 at 18:41

There is a filter called wp_prepare_themes_for_js in wp-admin/includes/theme.php in the wp_prepare_themes_for_js() function, which is called by wp-admin/themes.php to populate the theme set. That filter will allow you to remove themes from the list. Of course, you have to know the theme name.

function kill_theme_wpse_188906($themes) {
  return $themes;
  • May be a newbie question.Although you refer to wp_prepare_themes_for_js you unset themes. I also found this answer where they unset and return the prepared_themes. Is there any difference? Do you have a preference and why? – marikamitsos Sep 29 '16 at 3:25
  • No there is no difference. See, here in the function we passed the parameter as $themes and in there they did the same thing, but named the parameter $prepared_themes. So basically they are both identical. Just name of the parameter or passed variable is different which actually does not matter. @marikamitsos – CodeMascot Oct 25 '16 at 7:39
  • @the_dramatist Sorry for the late reply. I somehow thought that $themes and $prepared_themes are two distinct, "standard", WordPress core parameters that are initiated in succession one after the other. Not arbitrary. From your comment it seems that is not the case. Thank you for clarifying that. – marikamitsos Nov 8 '16 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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