Default text in a specific post type, but not visible?

I want to do two things. For a specific post type I want to have a default text. This have I been able to do with this code:

add_filter( ‘default_content’, ‘my_editor_content’, 10, 2 );

function my_editor_content( $content, $post ) {

switch( $post->post_type ) {
case ‘posttypehere’:
$content = ‘mydefaultposttextgoeshere’;
}

return $content;
}

This works great, I can see the text and it gets saved to the database.
But now I want to disable the text box entirely from this specific post type.
Which I can do with this code:

add_action(‘init’, ‘init_remove_support’,100);
function init_remove_support(){
$post_type = ‘posttypehere’;
remove_post_type_support( $post_type, ‘editor’);
}

And this will disable the text box.

But now the problem is that the default text will not be saved to the post when I publish it. So how can I achieve both?

Thank you!

Read more here:: Default text in a specific post type, but not visible?

Leave a Reply

Your email address will not be published. Required fields are marked *