0

My hosting company upgraded my remote Wordpress version of my site to 6.4.2 and as I mentioned in a previous ticket alot of things stopped working. One item that seems to be broken are the custom styles I have in my Wordpress theme to overwrite editor styles in the CMS. I used to load my theme CSS in the editor the following way in my functions.php file:

function add_support() {
    add_theme_support('menus');
    add_theme_support('wp-block-styles');
    add_theme_support('post-thumbnails');
    add_theme_support('title-tag');
    add_theme_support('responsive-embeds');
    add_theme_support('custom-logo');
    // load custom css for editor
    add_editor_style(get_template_directory_uri() . '/assets/css/style.css');
    add_editor_style(get_template_directory_uri() . '/assets/css/editor-styles.css');
    add_theme_support('editor-styles');
}

add_action('after_setup_theme', 'add_support');

Okay, after reading some questions here I decided to change where the support was loaded by adding an action after the 'admin_init' event and I removed the add_editor_style & add_theme_support in the add_support function. I added the following function to my functions.php file

function child_editor_styles() {
    add_theme_support('editor-styles');
    add_editor_style( [
        get_template_directory_uri() . '/assets/css/style.css',
        get_template_directory_uri() . '/assets/css/editor-styles.css'
    ] );
}

add_action('admin_init', 'child_editor_styles');

This doesn't overwrite or seem to add the CSS to the editor of my hosted wordpress version. I have a local MAMP Wordpress on my local machine to develop and experiment with code. Both versions of Wordpress, hosted and local are using Wordpress 6.4.2. Both have a PHP version of 8 with the hosted version having PHP 8 and local being 8.2. Both of the above functions load the css files in my local Wordpress version, neither seem to work on the hosted. I have checked that the file path for the CSS is correct on the hosted and it is? I am baffeled why this no longer seems to work on my hosted version but works on my local. I have checked file paths, css selectors and all is correct. The CSS files just don't seem to be loaded on the remote hosted version? Can anyone give me some ideas on how to resolve this issue?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.