How to *remove* a parent theme page template from a child theme?

Overriding that template would be much easier than getting rid of it. Just the way logic goes. I make no claim it’s efficient idea (late here), but this would get it nuked from edit screen: add_action(‘admin_head-post.php’,’remove_template’); function remove_template() { global $wp_themes; get_themes(); $templates = &$wp_themes[‘Twenty Ten’][‘Template Files’]; $template = trailingslashit( TEMPLATEPATH ).’onecolumn-page.php’; $key = array_search($template, … Read more

Use a template file for a specific url without creating a page

You can just look at url, load the file and exit. That can be done when WordPress loaded its environment, e.g. on ‘init’. add_action(‘init’, function() { $url_path = trim(parse_url(add_query_arg(array()), PHP_URL_PATH), “https://wordpress.stackexchange.com/”); if ( $url_path === ‘retail’ ) { // load the file if exists $load = locate_template(‘template-retail.php’, true); if ($load) { exit(); // just exit … Read more

Custom templates not showing up in template dropdown

Just in WordPress 4.9 there’s this bug: https://core.trac.wordpress.org/ticket/42573 causing the template files to only be rescanned once every hour. To fix (until they release a new WP version with this changed), download the patch on that bug ticket and make the changes from the patch to wp-includes/class-wp-theme.php. Hope this saves someone the 2 hours I … Read more