Last active
August 29, 2015 14:03
-
-
Save joshuadavidnelson/58209a7320638d740414 to your computer and use it in GitHub Desktop.
Remove parent page templates from dropdown option in child theme pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Removes parent theme page templates from the dropdown option on add new/edit page screen. | |
* | |
* Note that the path/to/ is from the parent theme directory, so if the page templates are in a subdirectory add that path, | |
* otherwise it can be written as 'page-template.php' | |
* | |
* @author Joshua David Nelson, josh@jdn.im | |
*/ | |
add_filter( 'theme_page_templates', 'jdn_remove_page_templates' ); | |
function jdn_remove_page_templates( $templates ) { | |
unset( $templates['path/to/page-template1.php'] ); | |
unset( $templates['path/to/page-template2.php'] ); | |
unset( $templates['path/to/page-template3.php'] ); | |
unset( $templates['path/to/page-template4.php'] ); | |
return $templates; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment