You can try to hook on load-page
hook instead of admin_init
. It is supposed to be called only when a page is being edited, and then you should be able to use the global $post
variable
function hide_editor() {
global $post;
$template_file = get_post_meta($post->ID, '_wp_page_template', true);
if($template_file == 'page-home.php'){ // template name here
remove_post_type_support('page', 'editor');
}
}
add_action( 'load-page', 'hide_editor' );
Related Posts:
- Add custom admin menu item for pages using a certain template
- How to make certain page templates visible to admin only
- Custom templates not showing up in template dropdown
- A check for if is parent page, if has children, if has grandchildren
- Create a “Dummy” parent page for a hierarchy in page listing?
- Restrict admin access to certain pages for certain users
- WordPress page edit does not save selected template
- Set page template automatically based on parent
- How to display code if it is not certain pages?
- How do I modify this page template to show subpage excerpts (not post excerpts)?
- Limit number of pages that use a specific template?
- How to inject custom url path for page ?
- Dynamically Load Styles and Scripts from Theme Functions.php
- Restrict acceess of a page in backend
- Hide page visual editor if template is selected – redux
- Only allow new subpages to be created
- Too many pages causes WordPress admin to be unusable
- Hide Visibility Option From WordPress Publish Metabox
- Different “Text Widgets” in Sidebar on Many Different Pages?
- How do I create multiple page while active a theme
- Backend option to include a javascript file on specific pages?
- wordpress with many custom styled static pages
- How to dynamically save a selected option from page “Templates” selectbox?
- How to add meta boxes to Pages
- Custom page template not working
- WordPress Admin – Add Edit link to specific page under Pages Menu
- Dynamically change page that loads
- How to use the same code for multiple pages?
- How to have custom tinyMCE buttons break onto next line when too long
- How do I pass data from page content to the underlying PHP template
- Determine page content based on page parent
- Force page to open in html mode
- Displaying page content in category archive (archive.php)
- Dash after page title
- Missing ‘Page Attributes’ in page edit
- Could be a namespace conflict (?) with login form and register form on the same page
- Custom page template for multiple pages
- My custom template page not loading content inside it?
- Get parent of current page
- How to edit a HTML list in WordPress?
- Custom page with queries returns 404
- JQuery Plugins in WordPress
- the_content of template page
- Remove comment section from new page
- WordPress theme: Add page content to the bottom of the Contact form
- Dynamic href link to Contact Page
- Create page template with some static contents
- WordPress 3.2 – removed ability to select a page template in the page attributes when adding a new page?
- Use same page-mypage.php template for several pages
- How to disable delete option for a specific page? [closed]
- Avoid pages losing template association on site re-deploy
- How do you implement a page template automatically being applied to a page?
- Need to create a custom page on a website
- How to exclude authors from get_pages()
- How do I edit text displayed on my browser tab?
- How to create different template designs for different pages in WordPress [closed]
- Different css file not working for the page template I created
- Order by modified date working in POSTS but not PAGES
- require_once not working
- Displaying posts on homepage – Template Page
- Page templates in subdirectories and auto generator
- WordPress Page doesn’t load the template selected
- Use page template for custom $_GET content
- Outputting content from page
- Custom folder for wordpress page templates
- Authors posts on a author created page
- Static Website No Titles But Still Nav
- custom page templating in WordPress
- Suggestions: Customizable header image and style colors that are different for each page
- Translate dashboard metabox
- Custom user tables not working after migration
- How to use custom page for all posts with custom url, call another directory?
- My pages are using my Index.php and not my page.php
- WordPress custom pages in a folder
- Create page template
- Page and admin doesnt load – i tried everything
- WordPress blog posts template bug [closed]
- Adding styles/scripts to specific page
- How to detect if some page template has been selected
- WordPress form submit to custom page template does not work
- Using external DB within wordpress
- How do I locate a third party page represented as a slug in my WordPress website?
- Customise the_title in admin area
- What’s the best way to manage sections on a page?
- How do you assign custom template for Posts page (under Front page displays setting)
- Content template when adding a new page
- custom page or standalone page?
- Avada Theme – Display results from a specific category [closed]
- How to display time when page is created and edited
- Specify parent page template
- WP Template Hierarchy – Need help choosing the correct templates
- Custom Filter using meta_value in wordpress admin list not working
- Group Pages based on Parent in Admin Area
- how bbPress and buddypress add their own page templates to the page template drop down on the page editing screen
- Create a new page for each form selection
- How to align bold,italic and underline in wp-admin?
- link a custom page into menu
- Load new Posts on Scroll on Page
- exclude page element from specific pages
- May I know where to edit the tax rate?