Theme Global Typography Affects WP Editor
-
Hey Support
When we edit the Global Typography in the theme customization in OceanWP theme, the line height for example applies to WP Post Editor Area. I disabled the “Use theme styles” in the Editor but it still applies. I think its a bug, or idk because i’m not a developer. I tried to add function by using chatgpt in functions.php file but i think the chatgpt is not providing the right code.
Code Added in functions.php file but none of them worked, the global typo. settings still applies// Exclude Customizer Typography Changes in the Editor
function remove_global_typography_editor() {
if (is_admin()) {
echo '<style>
body.block-editor-page .editor-styles-wrapper {
font-family: inherit !important;
font-size: inherit !important;
line-height: inherit !important;
}
</style>';
}
}
add_action('admin_head', 'remove_global_typography_editor');
ALSO TRIED THIS
// Remove theme styles from the editor
add_action('enqueue_block_editor_assets', function() {
wp_deregister_style('oceanwp-style'); // Adjust 'oceanwp-style' with your theme's style handle
});
// Ensure theme styles still load for the frontend but not the editor
add_action('after_setup_theme', function() {
remove_theme_support('editor-styles');
});
ALSO THIS ( this one actually did the same as we turn off the "Use theme styles" option.
add_action('admin_init', function() {
remove_editor_styles();
});In below images i tried to show the Global Typography settings i applied for testing and it also applies to the Editor Area of WordPress even the “Use theme styles” is off from the prefrences.
- You must be logged in to reply to this topic.