Home » Wordpress » WordPress dynamic CSS with wp-load

WordPress dynamic CSS with wp-load

Posted by: admin November 30, 2017 Leave a comment


I have a dynamic css file that pulls information from the database e.g

header("Content-type: text/css");


if ( get_option(PREFIX."_theme_base_color") <> "" ){
    $default_theme_colour = html_entity_decode(get_option(PREFIX."_theme_base_color"),ENT_QUOTES, "UTF-8"); 
} else {
    $default_theme_colour = 'a3f088';

but I really hate using require_once(‘../../../../wp-load.php’); and there has to be a better way
to loat “wp-load” into the file.


it seems that you are using some kind of plugin , or theme with plugin codes.

If you are the developer , you can read here :


At any case ,you can use bloginfo(‘wpurl’); or is you have set a BASENAME than **plugin_basename($file); **

if you are a simple user ,I suggest you leave that as it is .