Skip to:
Content
Pages
Categories
Search
Top
Bottom

What’s the best way to edit/override core functions?

  • I’d like to edit or override some core buddypress functions, for example, ‘bp_get_page_title()’.

    I don’t want to edit the core files directly, so I’ve set up a child theme. Can I copy the function from the file ‘bp-core-templatetags.php’ and paste it into my own ‘functions.php’ file and then somehow tell WordPress to unregister the core function (I know I can’t declare the same function twice). Or, should I copy the original function into my ‘functions.php’ file and rename it, effectively creating a new function?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)

  • Brajesh Singh
    Participant

    @sbrajesh

    Hi Matt,
    The best way would be to look for a filter in those functions and then change the output by adding your own functions on those filters.

    There is no way to tell wordpress to unregister a function unless it is used by an action/filter.
    So, will suggest to look into those functions and find appropriate filter to hook your function and change the output.

    Hope that helps.

    Hi Brajesh, thanks for the reply.

    I think I understand what you mean – I remember reading something before on changing the output of action/filter. I’ll look into it a bit more.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘What’s the best way to edit/override core functions?’ is closed to new replies.
Skip to toolbar