| @@ -12,8 +12,9 @@ | ||
| 12 | 12 | * @package PropertyHive/Classes |
| 13 | 13 | * @category Class |
| 14 | 14 | * @author PropertyHive |
| 15 | 15 | */ |
| 16 | +// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound -- Legacy public global class PH_Contact; preserving the existing PH_* class name is required for plugin and extension compatibility. | |
| 16 | 17 | class PH_Contact { |
| 17 | 18 | |
| 18 | 19 | /** @public int Contact (post) ID */ |
| 19 | 20 | public $id; |
| @@ -29,8 +30,9 @@ | ||
| 29 | 30 | |
| 30 | 31 | if ( $user_id > 0 ) |
| 31 | 32 | { |
| 32 | 33 | // We've been passed a user ID. Need to get contact ID based on user_id |
| 34 | + // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key, WordPress.DB.SlowDBQuery.slow_db_query_meta_value -- PH_Contact maps one WordPress user ID to one contact with fields=ids and posts_per_page=1. Both meta key and scalar value are fixed/typed; one-row result. | |
| 33 | 35 | $contact_query = new WP_Query( array( 'post_type' => 'contact', 'meta_key' => '_user_id', 'meta_value' => $user_id, 'fields' => 'ids', 'posts_per_page' => 1 ) ); |
| 34 | 36 | |
| 35 | 37 | if ( $contact_query->have_posts() ) |
| 36 | 38 | { |