How to sort wordpress posts already selected by WP_QUERY

I found the way how to reorder already selected posts. For exapmle, we have selected posts: $qargs = array( ‘posts_per_page’ => 15, ‘no_found_rows’ => true, ‘order’ => ‘DESC’, ‘post_type’ => ‘post’, ‘suppress_filters’ => false, ‘orderby’ => ‘post_views’, // here I order my posts by views ‘fields’ => ”, ‘date_query’ => array( array( ‘after’ => ‘-7 … Read more

Random output of comments using a shortcode

Easy thing would be to override comment query and set orderby property to rand. function wpse381090_comment_query_rand( $args ) { $args[‘orderby’] = ‘rand’; return $args; } add_filter(‘comments_template_query_args’, ‘wpse381090_comment_query_rand’);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)