AnsPress::add_action( string $hook, object $component, string $callback,  $priority = 10,  $accepted_args = 1 )

Description #

Add a new action to the collection to be registered with WordPress.

Parameters #

  • $hook
    string (Required) The name of the WordPress action that is being registered.
  • $component
    object (Required) A reference to the instance of the object on which the action is defined.
  • $callback
    string (Required) The name of the function definition on the $component.
  • int (Optional) $accepted_args The number of arguments that should be passed to the $callback.

Changelog #

VersionDescription
2.4Introduced.

Source #

File: anspress-question-answer.php

		public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
			$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
		}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment