• Resolved TC McCarthy

    (@tcmccarthy1)


    I am building out a website using a child theme for WirePress. In the parent theme’s functions.php file there is code to disable the admin bar:

    add_action(‘show_admin_bar’, ‘__return_false’);

    Of course, I am trying to follow the best practices of child theming and not making modifications to the parent but all of the ways I know to reverse this are not working.

    I have tried adding remove_action(‘show_admin_bar’, ‘__return_false’); to my functions.php file along with show_admin_bar(true) and remove_filter(‘show_admin_bar’, ‘__return_false’);

    None of these seems to disable the action in the parent theme. Any suggestions? I have confirmed commenting the line out of the parent theme re-enables the admin bar so I know preventing the action will solve the problem.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • I’m sorry but as you appear to be using a commercial parent theme, you need to seek support from the theme’s developer/vendor. We do not have access to, nor do we support, commercial products here.

    Thread Starter TC McCarthy

    (@tcmccarthy1)

    How about just speaking to the hooks in general — I’m not looking for support for the theme, but rather the concept. I appears remove_action isn’t working on this hook.

    Thread Starter TC McCarthy

    (@tcmccarthy1)

    I actually resolved it myself.

    Rather than removing the action I added the following line to my own functions file

    add_filter(‘show_admin_bar’, ‘__return_true’, 100); — by making the priority 100 I’m waiting until well after the parent theme turns the admin bar off before I turn it back on.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how to revert add_action('show_admin_bar', '__return_false'); using a child them’ is closed to new replies.