AnsPress_Admin::join_by_author_name( array $pieces, object $query )
Description #
Join users table in post table for searching posts by on user_login.
Parameters #
- $piecesarray (Required) Wp_Query mysql clauses.
- $queryobject (Required) Parent class.
Source #
File: admin/anspress-admin.php
public static function join_by_author_name( $pieces, $query ) { if ( isset( $query->query_vars['ap_author_name'] ) && is_array( $query->query_vars['ap_author_name'] ) && count( $query->query_vars['ap_author_name'] ) > 0 ) { global $wpdb; $authors = $query->query_vars['ap_author_name']; $authors = implode( "','", array_map( 'sanitize_title_for_query', array_unique( (array) $authors ) ) ); $authors = "'" . rtrim( $authors, ",'" ) . "'"; $pieces['join'] = " JOIN $wpdb->users users ON users.ID = $wpdb->posts.post_author AND users.user_login IN ($authors)"; // @codingStandardsIgnoreLine. } return $pieces; }
Expand full source code Collapse full source code View on GitHub: admin/anspress-admin.php:597
Add your comment