I'd like to replace an action in a theme with my own version in a child. In this case, the theme hooks into wp_head to add it's own links. My own functions.php resides in the child theme and looks like this:

global $SMTheme;
remove_action('wp_head', array($SMTheme, 'headtext'));
add_action('wp_head', 'custom_headtext');

Unfortunately, it's not working yet and I'm fairly new to this. This is how the theme adds it's action:

class SMTheme {
  var $options;

  function SMTheme() {
    // some unrelated code here         
    include TEMPLATEPATH."/inc/settings.php";
    // if (current_user_can('administrator')) {}
    add_action('wp_head', array(&$this, 'headtext'));
include TEMPLATEPATH."/inc/settings.php";

is your problem.


is used by the parent theme

For child themes use


so your code will be

include STYLESHEETPATH."/inc/settings.php";

Alternatively you can use

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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