Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8888925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:08:15+00:00 2026-06-14T22:08:15+00:00

Is there a way to hide a template file in admin? For example I

  • 0

Is there a way to hide a template file in admin?

For example I have a template that should only be available if a specific plugin is installed, and I already know how to check if plugin is active. But how do I hide the template?

For example I want to hide “Blogger Redirection”-template bellow:

Image is just an example...

I have found several links, but all of the solutions seems deprecated.

EDIT: If anyone is interested in how I check if pluin is active I do it with the following function:

function isPluginActive($plugin){
        if ( in_array( $plugin, apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) )
        {
            return true;
        }
        return false;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:08:16+00:00Added an answer on June 14, 2026 at 10:08 pm

    Update – a word of caution as pointed out by andrew in the comments below:

    Use this code with caution, If you have any pages using the template that you removed from the select, updating the page will cause it to revert to the default template


    I’m not sure if there is a PHP way of doing this – you’ll have to look in the WP_Theme class, but from my first look it might not be possible because in order to get all templates, the class utilizes an internal function called scandir() which scans the current theme directory and gets all .php files from there. It then looks for the corresponding Template Name: identifier and if it’s present it gets added to the templates list.

    So instead I suggest, that you add a little JS that will remove this option from the page template select. Here’s a code snippet:

    function my_remove_page_template() {
        global $pagenow;
        if ( in_array( $pagenow, array( 'post-new.php', 'post.php') ) && get_post_type() == 'page' ) { ?>
            <script>
                (function($){
                    $(document).ready(function(){
                        $('#page_template option[value="sidebar-page.php"]').remove();
                    })
                })(jQuery)
            </script>
        <?php 
        }
    }
    add_action('admin_footer', 'my_remove_page_template', 10);
    

    This will remove the template sidebar-page.php from the dropdown. The conditionals are so that the script is only added on add and edit screens of pages.

    Adjust to your case and enjoy 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to hide the textbox that is targeted by the colorpickerextender
Is there a way to hide UIAlertView programmatically? Actually I have added a UITextField
Is there any way to hide apps in the android market for devices that
Is there a way to hide the individual errors in a ASP:ValidationSummary so that
Is there any way to hide Summary for CListView without loosing pagination. By summary
Is there any way to hide or encrypt JavaScript code to prevent people from
Is there a way to hide a jButton in Netbeans? (similar to button.visible =
Is there a way to hide date and user info from a page post
Is there a way to hide the windows command prompt or prevent it from
Is there a way to hide the XHR finished loading messages in the console?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.