WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Remove Function from Parent Theme (6 posts)

  1. psiweb
    Member
    Posted 2 years ago #

    Hi Everyone,
    I am trying to remove a function from a parent theme and insert my own from the functions.php in my child theme. Actually I just want to update one little piece of the code everything else I can control via css. I am using Sandbox as my parent theme and I would like to change the function:

    sandbox_widgets_init

    I can not figure out how to do this, I have been trying to research it and maybe I am just missing something as I am fairly new to wordpress development, any suggestions would be greatly appreciated.

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    You will need to create your own version of the sandbox_widgets_init() function in your child theme's functions.php file.

  3. psiweb
    Member
    Posted 2 years ago #

    Thanks for the reply. I had tried to do this and it gives me an error:
    Fatal error: Cannot redeclare sandbox_widgets_init() (previously declared...

  4. psiweb
    Member
    Posted 2 years ago #

    As usual, I think I tried to over complicate this, I was able to get my function to work by removing the action and adding my action to it simply by adding the code below:

    remove_action( 'init', 'sandbox_widgets_init' );
    
    add_action( 'init', 'mysandbox_widgets_init' );

    Thanks for the quick reply.

  5. Port Elizabeth
    Member
    Posted 1 year ago #

    Did you ever figure this out as i'm looking to do the same?

    I have looked everywhere and tried most of what is on the internet but cant get this resolved!

  6. esmi
    Forum Moderator
    Posted 1 year ago #

    Please post your own topic.

Topic Closed

This topic has been closed to new replies.

About this Topic