WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
| Line | Code |
|---|---|
| 454 | * Enables creating comments for anonymous users. |
| 455 | * |
| 456 | * @since 4.7.0 |
| 457 | * |
| 458 | * @param bool $allow_anonymous Whether to allow anonymous comments to |
| 459 | * be created. Default `false`. |
| 460 | * @param WP_REST_Request $request Request used to generate the |
| 461 | * response. |
| 462 | */ |
| 463 | $allow_anonymous = apply_filters( 'rest_allow_anonymous_comments', false, $request ); |
| 464 | |
| 465 | if ( ! $allow_anonymous ) { |
| 466 | return new WP_Error( |
| 467 | 'rest_comment_login_required', |
| 468 | __( 'Sorry, you must be logged in to comment.' ), |
| 469 | array( 'status' => 401 ) |
| 470 | ); |
| 471 | } |
| 472 | } |