WP_Hook::do_action() WordPress Method

The do_action() method is used to trigger a specified action. This method is typically used by plugins and themes to hook into specific events within WordPress.

WP_Hook::do_action( array $args ) #

Calls the callback functions that have been added to an action hook.


Parameters

$args

(array)(Required)Parameters to pass to the callback functions.


Top ↑

Source

File: wp-includes/class-wp-hook.php

	public function do_action( $args ) {
		$this->doing_action = true;
		$this->apply_filters( '', $args );

		// If there are recursive calls to the current action, we haven't finished it until we get to the last one.
		if ( ! $this->nesting_level ) {
			$this->doing_action = false;
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
4.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.