Your if condition is wrong and generates a syntax error. You need an logical operator to check for multiple conditions. Therefore your code should look like the following:
if ( $template_file === 'page-custom-one.php' || $template_file === 'page-custom-two.php' ) {
remove_post_type_support( 'page', 'editor' );
}
You could also check for multiple values with the in_array function like this:
if ( in_array($template_file, ['page-custom-one.php', 'page-custom-two.php'], TRUE) ) {
remove_post_type_support( 'page', 'editor' );
}
Besides, you should always use strict comparison over loose comparison to prevent unexpected behaviour.
Related Posts:
- WordPress Visual Editor Stripping HTML Changes
- Shortcode to insert
- How to display php source code inside a post using visual editor?
- Create special button on WP Tiny MCE Posts Editor for Shortcodes
- Not able to add new item in wordpress home page
- Add Condition if WPBakery Page Builder Used on Page or Not
- How to fix ‘Notice: Undefined index:’ in PHP form action
- How to determine if WP_DEBUG is enabled? [duplicate]
- Pass a PHP variable to another file
- Using Global Variables Expensive for PHP
- One button to change all settings in theme customizer?
- Add custom image sizes to media uploader
- Export all post from database to JSON only when the database gets updated
- Multiple pages on one with different HTML
- Twitter feed is showing blank in WP site [closed]
- How to resolve error “Cookies are blocked due to unexpected output.”?
- Unique key for each row in a repeater field
- Is $hook a global variable in WordPress
- Notice: wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder
- Show different Customizer Settings on Page-Tamplates
- Convert imploded plain text into links
- Add “last” and “first” to WordPress Comment Pagination Links
- PHP if Condition not working
- How to return a foreach inside a shortcode
- Extend a class of a plugin
- Include a php file from functions.php only to homepage
- Customizer Show/Hide
- How to get the Page Number of the Current Page in Single Post Pagination
- How to restrict page access to logged-in users?
- Handling Body class based on Template
- Is XAMPP faster than running LAMP in WSL on Windows 10? [closed]
- Changing layout with wp_customise
- Get updated query results on page after insert in database
- Mass update excerpt
- Reconfiguring WordPress site
- Use Icomoon external svg file with
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- How to split links generated into an xml sitemap to avoid exceeding 30 sec maximum execution time?
- Hacked WordPress website /Homepage redirect [closed]
- Query if audio attachment AND/OR custom field
- Database query works fine outside WordPress
- Loading index.php contents which located outside blog folder for post single page
- WordPress page content outside WordPress
- Pull Tags But Not as Links
- Define specific category name in PHP
- Can I get an email notification when media is uploaded to the media library?
- PHP Syntax Error on get_posts
- Shortcode to find and replace URL
- Function Reference Documenting Template Tags for use in Custom Theme Templates?
- Seo Friendly Filter URLs
- PHP contact form not redirecting [closed]
- Add value to new attribute inside WordPress menu items
- Please show me how to use an if/else statement in combination with wp_enqueue
- Add new post in existing categories using wp_insert_post
- I’m unable to call img path using single quotes in an array?
- Else/If Statement to Display Photo Descriptions
- PHP error with a shortcode: “no suitable wrapper” for file_get_contents
- Use SCSSPHP to compile Theme Customizer Values into .SCSS files ready to compile to CSS
- php return username of currently viewed author profile
- Update value of a associative array with update_post_meta
- feedburner plugin for WP 3.5
- Redirect to current user page upon link click
- Adding wp_list_categories to a specific div that was appended using jQuery
- WordPress custom post type and taxonomy
- PHP code snippet to remove microdata
- Search AJAX Filters – Multiple Query Loops Into One Loop (Optimization)
- WP_Query: How to get results from both meta_key options?
- how to dynamically remove all edit and delete functionality of a page
- Generate a QR code when creating a new WordPress user
- Passing in MySQL prepare statement parameter separately throwing error
- I want to fusion the product columns in email table order
- wordpress email checker on domain
- Critical error on your site
- Using wp_editor() when not logged stopped working
- Paged WP_Query is quitting on page 3
- Need help with format of nested array in MySQL
- Is there a way to search for a missing endif?
- How to call WordPress PHP file using external js file
- Adding user meta to post meta wp_insert_post() not working
- Changing WordPress author name in database
- PHP: Why does my code work in index.php but not a widget?
- searching for members in wordpress
- Edit Post custom options not working
- jQuery doesn’t work in my php snippet
- Not able to get the exact URL of the file on server located in active wordpress theme
- How can I remove these resize lines from the comment box?
- Rearrange get_categories array compared to another array
- Changing code to remove 2 records for the first line
- use system script advertising in wordpress multisite
- Insert wordpress tags below posts via functions.php
- how to manipulate HTML parameters using PHP conditions
- Add multiple JavaScript files to template header [duplicate]
- Can i show items based on the day with php?
- How can I add page template after post of a post type?
- How to insert a variable into a query parameter?
- How to edit homepage in WordPress?
- Adding Custom JQuery Menu Fresh Slide Out
- Errors while Loading Most Recent Version of jQuery
- How I can give a php page a style from my theme
- Remove /Page/ from slug when we’re visiting 2nd and other inner pages of the blog page