How to add conent (text) to Add New pages form of admin in WordPress

The hook to use here is admin_notices. However in register_activation_hook and register_deactivation_hook it shouldn’t be used because these function run when plugin activates and deactivates instance.

A workaround it we use add_option when plugin activates and delete_option when plugin deactivates.

Here is the code. Hopefully you will understand it properly

    <?php 
    function my_admin_notice() {
        $screen = get_current_screen();
        if($screen->post_type != 'your-post-type-name')
            return;
        if($screen->base != 'post')
            return;
        ?>
        <div class="updated">
            <p><?php _e( 'Updated!', 'my-text-domain' ); ?></p>
        </div>
        <?php
    }

    function display_admin_notice(){
        $display_admin_msg = get_option('display_admin_msg');
        if($display_admin_msg == 1){
            add_action( 'admin_notices', 'my_admin_notice' );
        }
    }
    add_action('admin_init','display_admin_notice');

    function my_plugin_activate() {
         add_option('display_admin_msg',1);
    }
    register_activation_hook( __FILE__, 'my_plugin_activate' );


    function myplugin_deactivate(){
        delete_option('display_admin_msg');
    }
    register_deactivation_hook( __FILE__, 'myplugin_deactivate' );
 ?>

error code: 523