Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: pub_priv_sql_capability

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
6321           /**
6322            * Filters the capability to read private posts for a custom post type
6323            * when generating SQL for getting posts by author.
6324            *
6325            * @since 2.2.0
6326            * @deprecated 3.2.0 The hook transitioned from "somewhat useless" to "totally useless".
6327            *
6328            * @param string $cap Capability.
6329            */
6330           $cap = apply_filters( 'pub_priv_sql_capability', '' );
6331           if ( ! $cap ) {
6332                $cap = current_user_can( $post_type_obj->cap->read_private_posts );
6333           }
6334
6335           // Only need to check the cap if $public_only is false.
6336           $post_status_sql = "post_status = 'publish'";
6337           if ( false === $public_only ) {
6338                if ( $cap ) {
6339                     // Does the user have the capability to view private posts? Guess so.