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
4440 function get_posts_by_author_sql( $post_type, $full = true, $post_author = null, $public_only = false ) {
4441      global $user_ID, $wpdb;
4442
4443      // Private posts
4444      $post_type_obj = get_post_type_object( $post_type );
4445      if ( ! $post_type_obj )
4446           return $full ? 'WHERE 1 = 0' : ' 1 = 0 ';
4447
4448      // This hook is deprecated. Why you'd want to use it, I dunno.
4449      if ( ! $cap = apply_filters( 'pub_priv_sql_capability', '' ) )
4450           $cap = $post_type_obj->cap->read_private_posts;
4451
4452      if ( $full ) {
4453           if ( null === $post_author ) {
4454                $sql = $wpdb->prepare( 'WHERE post_type = %s AND ', $post_type );
4455           } else {
4456                $sql = $wpdb->prepare( 'WHERE post_author = %d AND post_type = %s AND ', $post_author, $post_type );
4457           }
4458      } else {