[ Index ] |
PHP Cross Reference of BuddyPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * BuddyPress Filters & Actions. 4 * 5 * This file contains the actions and filters that are used through-out BuddyPress. 6 * They are consolidated here to make searching for them easier, and to help 7 * developers understand at a glance the order in which things occur. 8 * 9 * @package BuddyPress 10 * @subpackage Hooks 11 * @since 1.6.0 12 */ 13 14 // Exit if accessed directly. 15 defined( 'ABSPATH' ) || exit; 16 17 /** 18 * Attach BuddyPress to WordPress. 19 * 20 * BuddyPress uses its own internal actions to help aid in third-party plugin 21 * development, and to limit the amount of potential future code changes when 22 * updates to WordPress core occur. 23 * 24 * These actions exist to create the concept of 'plugin dependencies'. They 25 * provide a safe way for plugins to execute code *only* when BuddyPress is 26 * installed and activated, without needing to do complicated guesswork. 27 * 28 * For more information on how this works, see the 'Plugin Dependency' section 29 * near the bottom of this file. 30 * 31 * v--WordPress Actions v--BuddyPress Sub-actions 32 */ 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. 37 add_action( 'parse_query', 'bp_parse_query', 2 ); // Early for overrides. 38 add_action( 'wp', 'bp_ready', 10 ); 39 add_action( 'set_current_user', 'bp_setup_current_user', 10 ); 40 add_action( 'setup_theme', 'bp_setup_theme', 10 ); 41 add_action( 'after_setup_theme', 'bp_after_setup_theme', 100 ); // After WP themes. 42 add_action( 'wp_enqueue_scripts', 'bp_enqueue_scripts', 10 ); 43 add_action( 'enqueue_embed_scripts', 'bp_enqueue_embed_scripts', 10 ); 44 add_action( 'admin_bar_menu', 'bp_setup_admin_bar', 20 ); // After WP core. 45 add_action( 'template_redirect', 'bp_template_redirect', 10 ); 46 add_action( 'widgets_init', 'bp_widgets_init', 10 ); 47 add_action( 'generate_rewrite_rules', 'bp_generate_rewrite_rules', 10 ); 48 49 /** 50 * The bp_loaded hook - Attached to 'plugins_loaded' above. 51 * 52 * Attach various loader actions to the bp_loaded action. 53 * The load order helps to execute code at the correct time. 54 * v---Load order 55 */ 56 add_action( 'bp_loaded', 'bp_setup_components', 2 ); 57 add_action( 'bp_loaded', 'bp_include', 4 ); 58 add_action( 'bp_loaded', 'bp_setup_option_filters', 5 ); 59 add_action( 'bp_loaded', 'bp_setup_cache_groups', 5 ); 60 add_action( 'bp_loaded', 'bp_setup_widgets', 6 ); 61 add_action( 'bp_loaded', 'bp_register_theme_packages', 12 ); 62 add_action( 'bp_loaded', 'bp_register_theme_directory', 14 ); 63 64 /** 65 * The bp_init hook - Attached to 'init' above. 66 * 67 * Attach various initialization actions to the bp_init action. 68 * The load order helps to execute code at the correct time. 69 * v---Load order 70 */ 71 add_action( 'bp_init', 'bp_register_post_types', 2 ); 72 add_action( 'bp_init', 'bp_register_taxonomies', 2 ); 73 add_action( 'bp_init', 'bp_core_set_uri_globals', 2 ); 74 add_action( 'bp_init', 'bp_setup_globals', 4 ); 75 add_action( 'bp_init', 'bp_setup_canonical_stack', 5 ); 76 add_action( 'bp_init', 'bp_setup_nav', 6 ); 77 add_action( 'bp_init', 'bp_setup_title', 8 ); 78 add_action( 'bp_init', 'bp_blocks_init', 10 ); 79 add_action( 'bp_init', 'bp_core_load_admin_bar_css', 12 ); 80 add_action( 'bp_init', 'bp_add_rewrite_tags', 20 ); 81 add_action( 'bp_init', 'bp_add_rewrite_rules', 30 ); 82 add_action( 'bp_init', 'bp_add_permastructs', 40 ); 83 84 /** 85 * The bp_register_taxonomies hooks - Attached to 'bp_init' @ priority 2 above. 86 */ 87 add_action( 'bp_register_taxonomies', 'bp_register_member_types' ); 88 add_action( 'bp_register_taxonomies', 'bp_register_type_metadata', 20 ); 89 90 /** 91 * Late includes. 92 * 93 * Run after the canonical stack is setup to allow for conditional includes 94 * on certain pages. 95 */ 96 add_action( 'bp_setup_canonical_stack', 'bp_late_include', 20 ); 97 98 /** 99 * The bp_template_redirect hook - Attached to 'template_redirect' above. 100 * 101 * Attach various template actions to the bp_template_redirect action. 102 * The load order helps to execute code at the correct time. 103 * 104 * Note that we currently use template_redirect versus template include because 105 * BuddyPress is a bully and overrides the existing themes output in many 106 * places. This won't always be this way, we promise. 107 * v---Load order 108 */ 109 add_action( 'bp_template_redirect', 'bp_redirect_canonical', 2 ); 110 add_action( 'bp_template_redirect', 'bp_actions', 4 ); 111 add_action( 'bp_template_redirect', 'bp_screens', 6 ); 112 add_action( 'bp_template_redirect', 'bp_post_request', 10 ); 113 add_action( 'bp_template_redirect', 'bp_get_request', 10 ); 114 115 /** 116 * Add the BuddyPress functions file and the Theme Compat Default features. 117 */ 118 add_action( 'bp_after_setup_theme', 'bp_check_theme_template_pack_dependency', -10 ); 119 add_action( 'bp_after_setup_theme', 'bp_load_theme_functions', 1 ); 120 add_action( 'bp_after_setup_theme', 'bp_register_theme_compat_default_features', 10 ); 121 122 // Load the admin. 123 if ( is_admin() ) { 124 add_action( 'bp_loaded', 'bp_admin' ); 125 } 126 127 // Activation redirect. 128 add_action( 'bp_activation', 'bp_add_activation_redirect' ); 129 130 // Email unsubscribe. 131 add_action( 'bp_get_request_unsubscribe', 'bp_email_unsubscribe_handler' );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 24 01:00:53 2024 | Cross-referenced by PHPXref 0.7.1 |