Description
This filter allows you to filter the arguments for the error message function. This allows all elements of the message to be filtered individually. The wrappers are separate from the message string, so you can filter the message separately from the styles.
$defaults = array( 'div_before' => '<div class="wpmem_msg" align="center">', 'div_after' => '</div>', 'p_before' => '<p>', 'p_after' => '</p>', 'toggles' => array( 'user', 'email', 'success', 'editsuccess', 'pwdchangerr', 'pwdchangesuccess', 'pwdreseterr', 'pwdresetsuccess' ), 'msg' => $string );
Parameters
$defaults
(array) (required) An array of arguments including defaults plus the message string.
$toggle
(string) (optional) Contains either the toggle for the message being generated or for additional messages, the custom message string.
$dialogs
(array) (optional) Contains an array of the message dialogs.
Changelog
Introduced in version 2.9.2
Added $dialogs paramter in 3.1.1
Source
wpmem_msg_dialog_arr is located in inc/dialogs.php
Usage
add_filter( 'wpmem_msg_dialog_arr', 'my_msg_dialog', 10, 2 ); function my_msg_dialog( $args, $toggle ) { /** * This example changes the div wrapper to * a different/custom class (default is .wpmem_msg). */ $args['div_before'] = '<div class="my_msg_class">'; /** * These example lines remove the '<p>' tag wrappers */ $args['p_before'] = ''; $args['p_after'] = ''; /** * This example changes the div wrapper * class based on a $toggle value (see defaults) */ if ( $toggle == 'success' ) { $args['div_before'] = '<div class="my_success_class">'; } /** return any values you are setting **/ return $args; }