admin管理员组文章数量:1387449
I have a question regarding Buddypress tweak.
I can use any Buddypress function when I make a plugin without any include or require functions.
How is it possible? Because Buddypress loads faster than my plugin?
In addition, What does global $bp mean? Withou this global $bp, I can use any buddypress functions, so why does it need?
I'm newbie to development. Thank you :)
I have a question regarding Buddypress tweak.
I can use any Buddypress function when I make a plugin without any include or require functions.
How is it possible? Because Buddypress loads faster than my plugin?
In addition, What does global $bp mean? Withou this global $bp, I can use any buddypress functions, so why does it need?
I'm newbie to development. Thank you :)
Share Improve this question asked Apr 14, 2020 at 1:40 hiyohiyo 356 bronze badges1 Answer
Reset to default 1Plugins load alphabetically by default. If Buddypress is alphbetically before your plugins folder name, then Buddypress will load first and it's functions will be available. Additionally, whatever functionality depends on another plugins you can always attach to the plugins_loaded
hook, which fires after all plugins are finished loading. For example:
/**
* Runs code after plugins have finished loading
*
* @return void
*/
function prefix_plugins_loaded() {
die( 'Plugins have finished loading.' );
}
add_action( 'plugins_loaded', 'prefix_plugins_loaded' );
PHP Globals are common in Plugins and WordPress. The $bp
global is simply a variable that likely holds a required object needed by the specific plugin function.
本文标签: plugin developmentBuddypress function and global bp question
版权声明:本文标题:plugin development - Buddypress function and global $bp question 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744570204a2613291.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论