S
S
Shimpanze2018-05-17 06:11:29
WordPress
Shimpanze, 2018-05-17 06:11:29

How would the professionals hide the textarea.wp-editor-area field from a certain page?

Good afternoon!
There is a page with ID=5. It has its own metaboxes (many). Tell me how you can gracefully hide the standard editor field (textarea.wp-editor-area) so that it does not hang out there.
Of course, I understand that it is possible with the help of CSS - hidden, but I want to go to the root.
It needs to be done in PHP.
Thank you very much for your advice!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Yanchevsky, 2018-05-17
@Shimpanze

Kind.

add_action('admin_head', 'hide_editor');

function hide_editor() {
    global $pagenow;
    $post_id = $_GET['post'];
    
    if ('post.php' != $pagenow || !$post_id) {
       return;
    }

    if ($post_id == '2011') {
        remove_post_type_support('page', 'editor');
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question