WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How would I override a bloginfo variable in wordpress?

For example, I want to replace this:

<?php bloginfo('stylesheet_directory'); ?>

to return a custom URL like http://mysites.com/hello/

share|improve this question

migrated from superuser.com May 29 '11 at 1:34

This question came from our site for computer enthusiasts and power users.

For the example you mentioned, you can add a filter to the stylesheet_directory hook

add_filter('stylesheet_directory','change_stylesheet_dir') ;

function change_stylesheet_dir($stylesheet_dir, $stylesheet, $theme_root) {
  # do stuff - change the stylesheet directory
  $new_stylesheet_directory = 'http://mysites.com/hello/';
  return new_stylesheet_directory ;

For any of the other parameters for bloginfo, you can look at the code for for bloginfo, which is in wp-includes/general-template.php. Follow the calls made for other bloginfo parameters to see whether there is a filter for it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.