comment_form_defaults
Filters the comment form default arguments.
Description
Use to filter the comment fields.
Parameters (1)
- 0. $defaults (array)
- The default comment form arguments.
Usage
- To run the hook, copy the example below.
- $defaults = apply_filters( 'comment_form_defaults', $defaults );
- if ( !empty( $defaults ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the comment_form_defaults callback
- function filter_comment_form_defaults( $defaults ) {
- // make filter magic happen here...
- return $defaults;
- };
- // add the filter
- add_filter( 'comment_form_defaults', 'filter_comment_form_defaults', 10, 1 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( 'comment_form_defaults', 'filter_comment_form_defaults', 10, 1 );
Defined (1)
The filter is defined in the following location(s).
- /wp-includes/comment-template.php
- $args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) );