When using the well-known framework Bootstrap 4 and Wordpress , Bootstrap "breaks" some styles in the admin panel, and to put it mildly, not really (example below).

Is it possible to load bootstrap styles before loading Wordpress admin panel styles?

Those. before this is displayed:

<link rel='stylesheet' href='http://localhost/wp-admin/load-styles.php... 

This method does not work:

 add_action( 'wp_head', 'load_first', 1 ); 

Similar problems with some other popular frameworks, for example: UIkit , Bulma . If the Bootstrap styles were loaded before the administration panel styles, then by logic Wordpress styles would become more priority and the situation would be corrected.

Or is another approach needed to solve this problem?

Example: bootstrap 4 and wordpress admin

    1 answer 1

    admin_enqueue_scripts - with prioritization installed, loads the Bootstrap styles earlier than the Wordpress admin panel styles, now the admin layout does not “go”. Although everything is not as perfect as we would like.

    wp_head - loads framework styles, but already on the site.

     define('THEME_URL', get_template_directory_uri()); function framework_load_first(){ $url = THEME_URL; echo "<link rel='stylesheet' id='Framework_Bootstrap' href='{$url}/public/css/bootstrap.min.css' type='text/css' media='all' />"; } add_action( 'admin_enqueue_scripts', "framework_load_first", 1); add_action( 'wp_head', 'framework_load_first',1); 

    An example of how Bootstrap behaves after using this method:

    enter image description here

    The UIkit framework - now also works well with the admin panel, but the Bulma framework still breaks some styles. Apparently Bulma needs special methods.