| 33 | | add_action( 'plugins_loaded', 'bp_loaded', 10 ); |
| 34 | | add_action( 'init', 'bp_init', 10 ); |
| 35 | | add_action( 'rest_api_init', 'bp_rest_api_init', 20 ); // After WP core. |
| 36 | | add_action( 'customize_register', 'bp_customize_register', 20 ); // After WP core. |
| | 33 | add_action( 'plugins_loaded', function() { |
| | 34 | |
| | 35 | /** |
| | 36 | * Fires on the 'plugins_loaded' hook, which fires after BP's core plugin files have been loaded. |
| | 37 | * |
| | 38 | * @since 1.2.5 |
| | 39 | */ |
| | 40 | do_action( 'bp_loaded' ); |
| | 41 | }, 10 ); |
| | 42 | add_action( 'init', function() { |
| | 43 | |
| | 44 | /** |
| | 45 | * Fires on the 'init' hook, BuddyPress' main initialization hook. |
| | 46 | * |
| | 47 | * @since 1.2.0 |
| | 48 | */ |
| | 49 | do_action( 'bp_init' ); |
| | 50 | }, 10 ); |
| | 51 | add_action( 'rest_api_init', function() { |
| | 52 | |
| | 53 | /** |
| | 54 | * Fires the 'bp_rest_api_init' function, where BuddyPress registers REST API endpoints. |
| | 55 | * |
| | 56 | * @since 2.6.0 |
| | 57 | */ |
| | 58 | do_action( 'bp_rest_api_init' ); |
| | 59 | }, 20 ); // After WP core. |
| | 60 | add_action( 'customize_register', function( WP_Customize_Manager $customizer ) { |
| | 61 | |
| | 62 | /** |
| | 63 | * Fires once the Customizer has loaded, allow scripts and styles to be initialized. |
| | 64 | * |
| | 65 | * @since 2.5.0 |
| | 66 | * |
| | 67 | * @param WP_Customize_Manager $customizer Customizer instance. |
| | 68 | */ |
| | 69 | do_action( 'bp_customize_register', $customizer ); |
| | 70 | }, 20 ); // After WP core. |
| 44 | | add_action( 'admin_bar_menu', 'bp_setup_admin_bar', 20 ); // After WP core. |
| | 86 | add_action( 'admin_bar_menu', function() { |
| | 87 | if ( bp_use_wp_admin_bar() ) { |
| | 88 | |
| | 89 | /** |
| | 90 | * Fires on the 'admin_bar_menu' hook, where plugins should add items to the WP admin bar. |
| | 91 | * This hook will only fire if bp_use_wp_admin_bar() returns true. |
| | 92 | * @since 1.5.0 |
| | 93 | */ |
| | 94 | do_action( 'bp_setup_admin_bar' ); |
| | 95 | } |
| | 96 | }, 20 ); // After WP core. |
| 56 | | add_action( 'bp_loaded', 'bp_setup_components', 2 ); |
| 57 | | add_action( 'bp_loaded', 'bp_include', 4 ); |
| 58 | | add_action( 'bp_loaded', 'bp_setup_cache_groups', 5 ); |
| 59 | | add_action( 'bp_loaded', 'bp_setup_widgets', 6 ); |
| | 108 | add_action( 'bp_loaded', function() { |
| | 109 | |
| | 110 | /** |
| | 111 | * Fires on the 'bp_loaded' action, where plugins should initialize components. |
| | 112 | * |
| | 113 | * @since 1.6.0 |
| | 114 | */ |
| | 115 | do_action( 'bp_setup_components' ); |
| | 116 | }, 2 ); |
| | 117 | |
| | 118 | add_action( 'bp_loaded', function() { |
| | 119 | |
| | 120 | /** |
| | 121 | * Fires on the 'bp_loaded' action, where plugins should include files. |
| | 122 | * |
| | 123 | * @since 1.2.5 |
| | 124 | */ |
| | 125 | do_action( 'bp_include' ); |
| | 126 | }, 4 ); |
| | 127 | add_action( 'bp_loaded', function() { |
| | 128 | |
| | 129 | /** |
| | 130 | * Fires on the 'bp_loaded' hook, where cache groups are registered. |
| | 131 | * |
| | 132 | * @since 2.2.0 |
| | 133 | */ |
| | 134 | do_action( 'bp_setup_cache_groups' ); |
| | 135 | }, 5 ); |
| | 136 | add_action( 'bp_loaded', function() { |
| | 137 | |
| | 138 | /** |
| | 139 | * Fires on the 'bp_loaded' hook, where plugins should register widgets. |
| | 140 | * |
| | 141 | * @since 1.2.0 |
| | 142 | */ |
| | 143 | do_action( 'bp_register_widgets' ); |
| | 144 | }, 6 ); |
| 70 | | add_action( 'bp_init', 'bp_register_post_types', 2 ); |
| 71 | | add_action( 'bp_init', 'bp_register_taxonomies', 2 ); |
| | 155 | add_action( 'bp_init', function() { |
| | 156 | |
| | 157 | /** |
| | 158 | * Fires on the 'bp_init' hook, where plugins should register post types. |
| | 159 | * |
| | 160 | * @since 2.5.0 |
| | 161 | */ |
| | 162 | do_action( 'bp_register_post_types' ); |
| | 163 | }, 2 ); |
| | 164 | |
| | 165 | add_action( 'bp_init', function() { |
| | 166 | |
| | 167 | /** |
| | 168 | * Fires on the 'bp_init' hook, where plugins should register taxonomies. |
| | 169 | * |
| | 170 | * @since 2.2.0 |
| | 171 | */ |
| | 172 | do_action( 'bp_register_taxonomies' ); |
| | 173 | }, 2 ); |
| | 174 | |
| 73 | | add_action( 'bp_init', 'bp_setup_globals', 4 ); |
| 74 | | add_action( 'bp_init', 'bp_setup_canonical_stack', 5 ); |
| 75 | | add_action( 'bp_init', 'bp_setup_nav', 6 ); |
| 76 | | add_action( 'bp_init', 'bp_setup_title', 8 ); |
| | 176 | add_action( 'bp_init', function() { |
| | 177 | |
| | 178 | /** |
| | 179 | * Fires on the 'bp_init' hook, where plugins should initialize global settings. |
| | 180 | * |
| | 181 | * @since 1.2.0 |
| | 182 | */ |
| | 183 | do_action( 'bp_setup_globals' ); |
| | 184 | }, 4 ); |
| | 185 | add_action( 'bp_init', function() { |
| | 186 | |
| | 187 | /** |
| | 188 | * Fires on the 'bp_init' hook, where plugins should set up their canonical URL. |
| | 189 | * |
| | 190 | * @since 2.1.0 |
| | 191 | */ |
| | 192 | do_action( 'bp_setup_canonical_stack' ); |
| | 193 | }, 5 ); |
| | 194 | add_action( 'bp_init', function() { |
| | 195 | |
| | 196 | /** |
| | 197 | * Fires on the 'bp_init' hook, where plugins should register their navigation items. |
| | 198 | * |
| | 199 | * @since 1.2.0 |
| | 200 | */ |
| | 201 | do_action( 'bp_setup_nav' ); |
| | 202 | }, 6 ); |
| | 203 | add_action( 'bp_init', function() { |
| | 204 | |
| | 205 | /** |
| | 206 | * Fires on the 'bp_init' hook, where plugins should modify the page title. |
| | 207 | * |
| | 208 | * @since 1.5.0 |
| | 209 | */ |
| | 210 | do_action( 'bp_setup_title' ); |
| | 211 | }, 8 ); |