fazarcon

Order by meta date

Jun 22nd, 2022
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) {
  2. if ( ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'my-query-2' ) !== false ) {
  3. $query_args['meta_key'] = 'meta-date';
  4. $query_args['orderby'] = 'meta_value_num';
  5. }
  6.  
  7. return $query_args;
  8. }, 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment