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
751            * The dynamic portion of the hook name, `$this->post_type`, refers to the post type slug.
752            *
753            * Pass false to disable trash support for the post.
754            *
755            * @since 4.7.0
756            *
757            * @param bool    $supports_trash Whether the post type support trashing.
758            * @param WP_Post $post           The Post object being considered for trashing support.
759            */
760           $supports_trash = apply_filters( "rest_{$this->post_type}_trashable", $supports_trash, $post );
761
762           if ( ! $this->check_delete_permission( $post ) ) {
763                return new WP_Error( 'rest_user_cannot_delete_post', __( 'Sorry, you are not allowed to delete this post.' ), array( 'status' => rest_authorization_required_code() ) );
764           }
765
766           $request->set_param( 'context', 'edit' );
767
768
769           // If we're forcing, then delete permanently.