Changeset 10926 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/post-meta.php
- Timestamp:
- 04/26/2021 11:09:28 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/post-meta.php
r10866 r10926 218 218 * Get a list of locales that are associated with at least one workshop. 219 219 * 220 * Optionally only published workshops. 221 * 220 222 * @param string $meta_key 221 223 * @param string $label_language 224 * @param bool $published_only 222 225 * 223 226 * @return array 224 227 */ 225 function get_available_workshop_locales( $meta_key, $label_language = 'english' ) {228 function get_available_workshop_locales( $meta_key, $label_language = 'english', $published_only = true ) { 226 229 global $wpdb; 227 230 231 $and_post_status = ''; 232 if ( $published_only ) { 233 $and_post_status = "AND posts.post_status = 'publish'"; 234 } 235 228 236 $results = $wpdb->get_col( $wpdb->prepare( 237 // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $and_post_status contains no user input. 229 238 " 230 SELECT DISTINCT meta_value231 FROM $wpdb->postmeta232 WHERE meta_key = %s233 ORDER BY meta_value ASC239 SELECT DISTINCT postmeta.meta_value 240 FROM {$wpdb->postmeta} postmeta 241 JOIN {$wpdb->posts} posts ON posts.ID = postmeta.post_id $and_post_status 242 WHERE postmeta.meta_key = %s 234 243 ", 235 244 $meta_key 245 // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared 236 246 ) ); 237 247
Note: See TracChangeset
for help on using the changeset viewer.