get_the_id wordpress
function get_the_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
$post = get_post();
return ! empty( $post ) ? $post->ID : false;
}
get_the_id wordpress
function get_the_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
$post = get_post();
return ! empty( $post ) ? $post->ID : false;
}
wp query get ids
/**
* Return an array of post IDs
*
* Build a more efficient query by only returning an array of post IDs.
*
* @author David Egan
* @return array Array of post IDs
* @see http://codex.wordpress.org/Class_Reference/WP_Query#Return_Fields_Parameter
*/
function carawebs_student_questionnaire_results(){
$args = array(
'post_type' => 'questionnaire-result',
'post_status' => 'publish',
'fields' => 'ids',
'meta_query' => array(
array(
'key' => 'user_type',
'value' => 'student',
'compare' => '=',
'type' => 'CHAR',
),
),
);
// The Query
$result_query = new WP_Query( $args );
$ID_array = $result_query->posts;
// Restore original Post Data
wp_reset_postdata();
return $ID_array;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us