Method
Construct the instance.
__construct( string $name, array $args = array() )
public
Parameters
-
$namestring - The action name.
-
$argsarray Defaultarray() -
Optional. An array of arguments.
-
$titlestring - The action title.
-
$slugstring - The action slug.
-
$callbackcallable - The action callback to fire when accessed.
-
$ajax_callbackcallable - The action callback to fire when accessed via AJAX.
-
$show_on_formsbool|string - Whether a link to the action should be shown on forms or not.
-
$show_in_widgetbool - Whether this action should be selectable in the widget or not.
-
$show_in_nav_menusbool - Whether this action should be available for use in nav menus or not.
-
$show_nav_menu_itembool - Whether to show an assigned nav menu item or not.
-
$show_in_slug_settingsbool - Whether this action should be shown in the slug settings or not.
-
Source
public function __construct( $name, $args = array() ) {
$this->set_name( $name );
$args = wp_parse_args(
$args,
array(
'title' => '',
'slug' => '',
'callback' => '',
'ajax_callback' => '',
'network' => false,
'show_on_forms' => true,
'show_in_widget' => true,
'show_in_nav_menus' => true,
'show_in_slug_settings' => true,
)
);
if ( ! isset( $args['show_nav_menu_item'] ) ) {
$args['show_nav_menu_item'] = $args['show_in_nav_menus'];
}
$this->set_title( $args['title'] );
$this->set_slug( $args['slug'] );
$this->set_callback( $args['callback'] );
$this->set_ajax_callback( $args['ajax_callback'] );
$this->network = (bool) $args['network'];
$this->show_on_forms = $args['show_on_forms'];
$this->show_in_widget = (bool) $args['show_in_widget'];
$this->show_in_nav_menus = (bool) $args['show_in_nav_menus'];
$this->show_nav_menu_item = (bool) $args['show_nav_menu_item'];
$this->show_in_slug_settings = (bool) $args['show_in_slug_settings'];
} View src/includes/class-theme-my-login-action.php, line 114 on GitHub
Uses
Used by
Changelog
| Version | Description |
|---|---|
| 7.0 | Introduced. |