did_action( string $hook_name ): int
Retrieves the number of times an action has been fired during the current request.
Parameters
-
$hook_name
string Required -
The name of the action hook.
Return
int The number of times the action hook has been fired.
Source
File: wp-includes/plugin.php
.
View all references
function did_action( $hook_name ) {
global $wp_actions;
if ( ! isset( $wp_actions[ $hook_name ] ) ) {
return 0;
}
return $wp_actions[ $hook_name ];
}
Related
Used By
Used By | Description |
---|---|
wp_get_loading_optimization_attributes() wp-includes/media.php |
Gets loading optimization attributes. |
wp_get_loading_attr_default() wp-includes/deprecated.php |
Gets the default value to use for a |
wp_enqueue_block_style() wp-includes/script-loader.php |
Enqueues a stylesheet for a specific block. |
wp_default_packages_vendor() wp-includes/script-loader.php |
Registers all the WordPress vendor scripts that are in the standardized |
wp_default_packages() wp-includes/script-loader.php |
Registers all the WordPress packages scripts. |
WP_Privacy_Policy_Content::text_change_check() wp-admin/includes/class-wp-privacy-policy-content.php |
Performs a quick check to determine whether any privacy info has changed. |
wp_add_privacy_policy_content() wp-admin/includes/plugin.php |
Declares a helper function for adding content to the Privacy Policy Guide. |
wp_switch_roles_and_user() wp-includes/ms-blogs.php |
Switches the initialized roles and current user capabilities to another site. |
_WP_Editors::enqueue_default_editor() wp-includes/class-wp-editor.php |
Enqueue all editor scripts. |
WP_Customize_Manager::_publish_changeset_values() wp-includes/class-wp-customize-manager.php |
Publishes the values of a changeset. |
WP_Customize_Manager::import_theme_starter_content() wp-includes/class-wp-customize-manager.php |
Imports theme starter content into the customized state. |
_wp_customize_publish_changeset() wp-includes/theme.php |
Publishes a snapshot’s changes. |
WP_Site::__get() wp-includes/class-wp-site.php |
Getter. |
WP_Site::__isset() wp-includes/class-wp-site.php |
Isset-er. |
register_rest_route() wp-includes/rest-api.php |
Registers a REST API route. |
wp_cron() wp-includes/cron.php |
Registers _wp_cron() to run on the {@see ‘wp_loaded’} action. |
add_theme_support() wp-includes/theme.php |
Registers theme support for a given feature. |
_remove_theme_support() wp-includes/theme.php |
Do not use. Removes theme support internally without knowledge of those not used by themes directly. |
wp_admin_css() wp-includes/general-template.php |
Enqueues or directly prints a stylesheet link to the specified CSS file. |
wp_load_translations_early() wp-includes/load.php |
Attempts an early load of translations. |
wp_allowed_protocols() wp-includes/functions.php |
Retrieves a list of protocols to allow in HTML attributes. |
_default_wp_die_handler() wp-includes/functions.php |
Kills WordPress execution and displays HTML page with an error message. |
create_initial_taxonomies() wp-includes/taxonomy.php |
Creates the initial taxonomies. |
WP_Admin_Bar::_render() wp-includes/class-wp-admin-bar.php | |
WP_User_Query::query() wp-includes/class-wp-user-query.php |
Executes the query, with the current variables. |
get_the_content() wp-includes/post-template.php |
Retrieves the post content. |
wp_enqueue_media() wp-includes/media.php |
Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs. |
wp_oembed_add_provider() wp-includes/embed.php |
Adds a URL format and oEmbed provider URL pair. |
wp_oembed_remove_provider() wp-includes/embed.php |
Removes an oEmbed provider. |
wp_video_shortcode() wp-includes/media.php |
Builds the Video shortcode output. |
wp_audio_shortcode() wp-includes/media.php |
Builds the Audio shortcode output. |
WP_Rewrite::wp_rewrite_rules() wp-includes/class-wp-rewrite.php |
Retrieves the rewrite rules. |
WP_Rewrite::flush_rules() wp-includes/class-wp-rewrite.php |
Removes rewrite rules and then recreate rewrite rules. |
wpdb::check_connection() wp-includes/class-wpdb.php |
Checks that the connection to the database is still up. If not, try to reconnect. |
wpdb::select() wp-includes/class-wpdb.php |
Selects a database using the current or provided database connection. |
wp_register_sidebar_widget() wp-includes/widgets.php |
Register an instance of a widget. |
wp_register_widget_control() wp-includes/widgets.php |
Registers widget control callback for customizing options. |
_register_widget_form_callback() wp-includes/widgets.php |
Registers the form callback for a widget. |
WP_Customize_Widgets::call_widget_update() wp-includes/class-wp-customize-widgets.php |
Finds and invokes the widget update and control callbacks. |
print_head_scripts() wp-includes/script-loader.php |
Prints the script queue in the HTML head on admin pages. |
wp_print_head_scripts() wp-includes/script-loader.php |
Prints the script queue in the HTML head on the front end. |
script_concat_settings() wp-includes/script-loader.php |
Determines the concatenation and compression settings for scripts and styles. |
wp_default_scripts() wp-includes/script-loader.php |
Registers all WordPress scripts. |
Changelog
Version | Description |
---|---|
2.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
Example
Using did_action() function to make sure custom meta field is only added during the first run since it can run multiple times.