AnsPress::add( array $hooks, string $hook, object $component, string $callback, int $priority, int $accepted_args )

Description #

A utility function that is used to register the actions and hooks into a single collection.

Parameters #

  • $hooks
    array (Required) The collection of hooks that is being registered (that is, actions or filters).
  • $hook
    string (Required) The name of the WordPress filter that is being registered.
  • $component
    object (Required) A reference to the instance of the object on which the filter is defined.
  • $callback
    string (Required) The name of the function definition on the $component.
  • $priority
    int (Required) The priority at which the function should be fired.
  • $accepted_args
    int (Required) The number of arguments that should be passed to the $callback.

Changelog #


Source #

File: anspress-question-answer.php

		private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
			$hooks[] = array(
				'hook'          => $hook,
				'component'     => $component,
				'callback'      => $callback,
				'priority'      => $priority,
				'accepted_args' => $accepted_args,

			return $hooks;

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