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
5349      /**
5350       * Filter the capability to read private posts for a custom post type
5351       * when generating SQL for getting posts by author.
5352       *
5353       * @since 2.2.0
5354       * @deprecated 3.2.0 The hook transitioned from "somewhat useless" to "totally useless".
5355       *
5356       * @param string $cap Capability.
5357       */
5358      if ( ! $cap = apply_filters( 'pub_priv_sql_capability', '' ) ) {
5359           $cap = $post_type_obj->cap->read_private_posts;
5360      }
5361
5362      $sql = $wpdb->prepare( 'post_type = %s', $post_type );
5363
5364      if ( null !== $post_author ) {
5365           $sql .= $wpdb->prepare( ' AND post_author = %d', $post_author );
5366      }
5367