Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
_llms_query_user_postmeta( int $user_id, int $post_id, string $meta_key = null, string $meta_value = null )
Query user postmeta data.
Description Description
This function is marked for internal use only.
Parameters Parameters
- $user_id
-
(int) (Required) WP User ID.
- $post_id
-
(int) (Required) WP Post ID.
- $meta_key
-
(string) (Optional) Meta key.
Default value: null
- $meta_value
-
(string) (Optional) Meta value.
Default value: null
Return Return
(array)
Source Source
File: includes/functions/llms.functions.user.postmeta.php
function _llms_query_user_postmeta( $user_id, $post_id, $meta_key = null, $meta_value = null ) { global $wpdb; $key = $meta_key ? $wpdb->prepare( 'AND meta_key = %s', $meta_key ) : ''; $val = $meta_value ? $wpdb->prepare( 'AND meta_value = %s', $meta_value ) : ''; // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared $res = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}lifterlms_user_postmeta WHERE user_id = %d AND post_id = %d {$key} {$val} ORDER BY updated_date DESC", $user_id, $post_id ) ); // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared return $res; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.21.0 | Introduced. |