Skip to:
Content
Pages
Categories
Search
Top
Bottom

Wrapper function if BP is activated?


  • Andrew Tegenkamp
    Participant

    @andrewteg

    I’m following along with https://codex.buddypress.org/plugindev/how-to-edit-group-meta-tutorial/ to add some group meta and it works great.

    I’m wondering if the second code block “wrapper function if BP is activated” is still the preferred way and if it’s required. I haven’t seen that in other plugins with robust hooks and filters recently like Woo (where it just uses Woo based hooks and filters) so I wasn’t sure if the wrapper here was required, suggested, or completely optional at this point in BP development.

    Thanks!
    Andrew

Viewing 1 replies (of 1 total)

  • danbp
    Participant

    @danbp

    @andrewteg,

    there is a little link on your example to another codex page who give’s you the main reason for using a wrapper.

    It is not required, but strongly recommended. Depending what, where and how your code should run, they are diffrent other ways to ensure that BP is active.
    the classic php if_class_exist()
    or more a la BP specific

    if ( function_exists('bp_is_active') ) {
      // do something here...
    }
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar