JS Function to remove templates stopped working with 4.2.3
-
Hi,
I was using a jQuery function to remove templates from the template menu in a page edit screen. It was working well, but seems to have stopped working with the 4.2.3 update (though perhaps that’s coincidence).
Following is the function from my functions.php file. I sure would appreciate any thoughts.
/* remove most page templates to keep things simple */ function my_remove_page_template() { global $pagenow; if ( in_array( $pagenow, array( 'post-new.php', 'post.php') ) && get_post_type() == 'page' ) { ?> <script type="text/javascript"> (function($){ $(document).ready(function(){ $('#page_template option[value="sidebar-content-half-page.php"]').remove(); $('#page_template option[value="sidebar-content-page.php"]').remove(); $('#page_template option[value="sitemap.php"]').remove(); $('#page_template option[value="full-width-page.php"]').remove(); $('#page_template option[value="landing-page.php"]').remove(); $('#page_template option[value="content-sidebar-page.php"]').remove(); $('#page_template option[value="content-sidebar-half-page.php"]').remove(); $('#page_template option[value="blog.php"]').remove(); $('#page_template option[value="blog-excerpt.php"]').remove(); }) })(jQuery) </script> <?php } } add_action('admin_footer', 'my_remove_page_template', 10);
Thanks ??
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘JS Function to remove templates stopped working with 4.2.3’ is closed to new replies.