How to override Buddypress core files?

Hi there. I’m trying to figure out how to override Buddypress core files correctly. I would like to tweak a file called class-bp-core-members-widget.php that is in /plugins/buddypress/bp-members/classes/ but in a safe way that won’t be erased if Buddypress were to update. I know that with buddypress templates, you follow the template hierarchy in the child theme and copy the files, etc, but doing the same with the core files doesn’t work.

I tried to do googling but nothing was really clear enough on how to approach this. Any help? Thanks in advance!

  • Nastia
    • Support Rock Star

    Hello Alayna

    You definitely want to stay away from modifying the core files of any plugin (or theme, or WordPress itself) as most all of them will receive updates. The best thing to do is alter their functionality and output from your own active child theme or custom plugin.

    You can add the code to functions.php file of your child theme.

    I hope this helps!

    Kind Regards,


  • Alex Stine
    • System Administrator


    You can add the code to functions.php file of your child theme.

    Actually, not completely true. Some things that you need to change do not have hooks. If you cannot change it with functions.php, you have to edit core files. Just write down your changes. :slight_smile:


    Alex :smiley:

  • Alayna
    • Site Builder, Child of Zeus

    Hello, thank you both for your answers!

    Alex, since nothing was working for me, I was definitely considering just writing down my changes. I am leaning towards that option.

    Nastia, how would I go about altering their functionality so I can put it in functions.php in my child theme? I have many custom functions in that file but I don’t know how to move core functions over there. Moving them over and adding my modifications generates an error since the classes can’t be redeclared. I guess what I’m trying to say is how do I fix it so it only recognizes it once from my functions.php or bp-custom.php file and not from the core files? Is that at all possible?

    Thank you both!

  • Panos
    • SLS

    Hello Alayna ,

    I totally agree with both :slight_smile: If you desperately need some custom functionality and have exhausted all other ways of overriding, only then edit core files and always keep backup and make sure you test in a testing environment first.

    Before reaching that point though, could you try out the plugin I have attached? It is a replicate of the file you mention and should produce a new widget called “(BuddyPress) Custom Members”.

    You can first check if it works as it is and if it looks OK to you, you can start passing your modifications one by one in the plugin’s file (there’s only one file included :slight_smile: ) and each time check if there is any error.

    Please let us know how it goes or if you need any further assistance!

    Kind regards,


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.