Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: rest_{$this->post_type}_trashable

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
1014            *  - `rest_attachment_trashable`
1015            *
1016            * Pass false to disable Trash support for the post.
1017            *
1018            * @since 4.7.0
1019            *
1020            * @param bool    $supports_trash Whether the post type support trashing.
1021            * @param WP_Post $post           The Post object being considered for trashing support.
1022            */
1023           $supports_trash = apply_filters( "rest_{$this->post_type}_trashable", $supports_trash, $post );
1024
1025           if ( ! $this->check_delete_permission( $post ) ) {
1026                return new WP_Error(
1027                     'rest_user_cannot_delete_post',
1028                     __( 'Sorry, you are not allowed to delete this post.' ),
1029                     array( 'status' => rest_authorization_required_code() )
1030                );
1031           }
1032