thank you so much for your reply, what I did is created a widget where I want to display the links and there will be a “more..” link to archive page that will display all the questions the user has replayed and I was considering all users as I am adding the widget in single page . so I modified the snippet to make it something like
function dwqa_refilter_question( $args = null, $number_of_post = 5, $user = get_current_user_id() ) {
// change 0 to page id you had place other archive page contain shortcode [dwqa-list-questions]
//if ( is_page( 0 ) ) {
$answer_args = array(
'post_type' => 'dwqa-answer',
'posts_per_page' => $number_of_post,
'post_status' => 'publish',
'fields' => 'ids',
'no_found_rows' => true,
'update_post_term_cache' => false,
'update_post_meta_cache' => false,
'author' => $user,
'orderby' => 'date'
);
// this will return array with 5 answer's ids
$answers = get_posts( $answer_args );
$question_lists = array();
foreach( $answers as $answer_id ) {
$question_lists[] = get_post_meta( $answer_id, '_question', true );
}
$args['post__in'] = $question_lists;
//}
return $args;
}
no I can provide it the number of post it will return and also the user id for which it will return the questions. now I would like to add my own archive page to display all the questions links the user has answered for which I have already created a separate thread .