How do I add text or message above the featured image area in gutenberg for a CPT

Try this:

function wrapPostFeaturedImage( OriginalComponent ) {
    const currentPostType = wp.data.select( 'core/editor' ).getCurrentPostType();

    // Do nothing, if the post type is not rt_brands.
    if ( 'rt_brands' !== currentPostType ) {
        return OriginalComponent;
    }

    return function( props ) {
        // Your code here.
    };
}

You can also:

  • Conditionally add your filter:

    // Check if the current admin page is post-new.php or post.php, and that the
    // post type of the post being added/edited is rt_brands.
    if ( 'rt_brands' === window.typenow && 'post-php' === window.adminpage ) {
        // Add your filter, i.e. call wp.hooks.addFilter().
    }
    
  • Conditionally enqueue your script:

    function rt_featured_img_enqueue_script() {
        $screen = get_current_screen();
        if ( 'rt_brands' === $screen->post_type && 'post' === $screen->base ) {
            // Enqueue your featured_img.js script, i.e. call wp_enqueue_script().
        }
    }
    

deneme bonusudeneme bonusu veren sitelerpulibet girişOnwin Güncel Giriştürkçe altyazılı pornocanlı bahis casino