If you read the code (in version 4.5.2 on line 164-173) you will see that orderby
can be an array of values, coupled with order
. So you could modify $args
like this:
$args = array(
'orderby' => array(
array ('sticky' => 'DESC'),
array ('registered' => 'DESC')),
'fields' => 'all_with_meta',
);
Note that I know nothing about how woocommerce defines the sticky user role, so I don’t know if this code will actually work. It only shows how to implement a multidimensional array in the query.
Related Posts:
- Query users and count totals based on meta values
- Show newly added posts since last user login time /date
- How can I let users to access plugin functions based on roles?
- Users instead of posts: How to modify the main query?
- Custom search form to display users only
- Getting users by specific capability, not role
- Display posts from multiple user roles
- How to get the role id from the role name?
- How do I make a variable available inside partials?
- Enabling users to control custom loop’s query
- How can I prevent certain custom roles from seeing other custom roles on the user list page?
- How to get user ID’s from multiple usernames?
- current-user_can not working in loop
- Override orderby to create list of users by custom meta_value
- Get a Post Loop based on Logged in User information into a Shortcode
- Find count of WordPress users by role and search string for user name
- How to get all multi-select user meta values and add them to an array?
- Show a list of user posts in the user admin page
- Loop 1 user randomly
- Display all existing members
- Combine Query and Select Database to create directory loop
- Show only users with the same role in Dashboard user list
- wp_mail function not working in user query loop
- How do I programmatically set default role for new users?
- How to split a loop into multiple columns
- Is it necessary to reset the query after using get_posts()?
- Cleanest Way to Select Every Second Element in a Loop?
- Get post by page name or slug
- save_post + insert_post = infinite loop
- Get ID of a page containing secondary loop in content
- ACF Repeater loops and resets – where is the reset_rows() documentation? [closed]
- Why do themes have `while( have_posts() )` in templates like single.php?
- User roles – enable custom posts disable posts
- What is best way passing variables to theme templates and using them different places like widgets?
- Apply styling only to first page sticky posts
- Exclude category by slug for for each loop
- pop-up lighbox with AJAX
- How to get the Role Name of the current user? (WordPress)
- Load comments per post on click with AJAX
- The main Loop is not starting in a custom blog template page
- connect last post with first post
- Custom loop with conditional statement to separate each terms
- taxonomy tags 404 to custom post types
- Register rest field for specific user
- Breaking the loop?
- Error: How to allow the “contributor” to upload media in wordpress
- woocommerce stored variable
- WP_User_Query pulling ACF to loop
- how to know when the user is in specific part of the website and when he leaves that part and display the data in the admin dashboard
- A smarter way to display multiple loops inside a page template
- How to print out menu names in the foreach loop?
- How do I style the first two posts of a loop
- Do I need to use The Loop on pages?
- How do I paginate a get_posts() request inside another page loop (Paginating childpages)
- How do I let contributors edit their posts after being approved once?
- Is wp_reset_postdata() redundant after the main loop?
- Hide custom post type by user roles
- While loop with bootstrap [closed]
- How to create a multidimensional array with multiple loops
- How to create custom popup in shop page on every loop products?
- Fix ‘Add Role’ Option not there in wordpress 5.2.2
- Getting posts link in WordPress
- Loop through an array inside a class using foreach [closed]
- using wp_get_attachment_image_src in foreach loop
- How to separate posts loop in to two columns? [duplicate]
- query_posts clarification needed
- Adding first and last classes to three column layout in Bones boilerplate
- Plugin permissions for Editor role
- Role based permission edit for plugins
- Does search.php autofilter The Loop?
- “the_excerpt” in loop just keeps repeating first post?
- wpdb inside foreach loop only returns first result – 2 other similar cases found [closed]
- Using jQuery .after inside loop
- Add 2 values to post__not_in
- How to loop specific Category menu from archive page?
- How can I pass additional params to a shortcode while in a loop?
- Getting user data via ajax
- Add all category as classes in foreach loop
- Exclude posts from loop by term
- How to avoid appending “null” in Ajax?
- Attachment Metadata inside of Loop
- Modify widget to output posts in custom order
- Template included with plugin doesn’t return all posts for custom taxonomy
- Limit article to 100 characters. Can’t use the_excerpt…
- Adding pagination to WP_Query [duplicate]
- Insert/sticky multiple posts in multiple positions
- Get author meta of all writers
- This webpage has a redirect loop issue with SSL page
- Buddypress Group Activity Loop Filter activity type [closed]
- Stuck with conflicting loops on page template
- How to get current page id and compare it to looped pages inside the same page?
- Show amount of posts created today above loop?
- How to create WordPress loop with combination of 4 and 2 columns twitter-bootstrap?
- The post order is different for logged-in and non-logged-in users? [closed]
- i need to let a user to add a role from a frontend form
- posts_nav_link() not working on index.php
- How to add custom HTML markup and classes to the_content()?
- $do_not_duplicate is not working in genesis theme
- Loop displays current page
- How to create a specific role to manage users