Site logo

[Resolved] Load editor-stylesheet after gp inline styles

Home Forums Support [Resolved] Load editor-stylesheet after gp inline styles

Home Forums Support Load editor-stylesheet after gp inline styles

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1895001
    AM

    Hi,
    I’d like to load the editor-stylesheet in my child theme after generate-block-editor-styles-inline-css.
    This post suggests that it should be loaded last. But I guess that’s for the front-end, since in the editor it loads before the gp inline styles.

    I’m enqueuing my editor-stylesheet according to this post. And I tried to name generate-block-editor-styles-inline-css as a handle, but that failed and let my editor-stylesheet disappear.

    The following code returns my editor-stylesheet before the inline css.

    function my_editor_styles(){
        wp_enqueue_style( 'my-editor-style-handle', get_stylesheet_directory_uri() . "/theme-styles/editor-styles.css", false, '1.0', 'all' );
    }
    add_action( 'enqueue_block_editor_assets', 'my_editor_styles');
    

    The following code makes my editor-stylesheet disappear.

    function my_editor_styles(){
        wp_enqueue_style( 'my-editor-style-handle', get_stylesheet_directory_uri() . "/theme-styles/editor-styles.css", array( 'generate-block-editor-styles-inline-css' ), '1.0', 'all' );
    }
    add_action( 'enqueue_block_editor_assets', 'my_editor_styles');
    

    Any suggestions for a solution? Right now I’m using !important, but that’s pretty ugly.
    Thanks in advance.

    #1895398
    David
    Staff
    Customer Support

    Hi there,

    not sure but try increasing the priority of your add_action eg.

    add_action( 'enqueue_block_editor_assets', 'my_editor_styles');

    becomes:

    add_action( 'enqueue_block_editor_assets', 'my_editor_styles', 100);

    It should hook you’re request in later, you can increase the 100 value if it still doesn’t work. But you should be able to see if its moved down the list.

    #1898740
    AM

    Thanks. Had to set it to 200, but then it worked.

    #1898768
    David
    Staff
    Customer Support

    Glad to hear that!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.