# Use the Classic Editor for Selected Pages or Templates

> Opens specific pages, or pages using certain templates, in the classic editor while everything else keeps the block editor.

- Type: PHP
- Runs: Run everywhere
- Category: [Block Editor](https://wpide.com/library/category/gutenberg/)
- Tags: classic-editor, pages, templates
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/classic-editor-for-selected-pages/

## Code

```php
// Post or page IDs that open in the classic editor.
$wpide_classic_editor_ids = array( 0 );
// Page template file names that open in the classic editor.
$wpide_classic_editor_templates = array( 'template-legacy.php' );

add_filter( 'use_block_editor_for_post', function ( $use, $post ) use ( $wpide_classic_editor_ids, $wpide_classic_editor_templates ) {
    if ( ! $post ) {
        return $use;
    }

    if ( in_array( (int) $post->ID, array_map( 'absint', $wpide_classic_editor_ids ), true ) ) {
        return false;
    }

    $template = get_page_template_slug( $post );

    if ( $template && in_array( $template, $wpide_classic_editor_templates, true ) ) {
        return false;
    }

    return $use;
}, 10, 2 );
```

## Notes

List page IDs and template file names, such as template-legacy.php. Requires the classic editor to be available (it is built in for posts that opt out).

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Use the Classic Editor for Selected Pages or Templates" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
