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
- Users as team members through a loop in elementor
- Add new post only in assigned category
- Popular posts with Varnish ESI
- Querying posts from only one category and exluding the latest post
- Highlight specific user with custom field value
- Attachment Metadata inside of Loop
- Allowing users to edit only their page and nobody else’s
- How to order users alphabetically by name? in plugin UPME
- How can I make this iterative conditional within the Loop work via function?
- Posts Per Page is Not Returning Correct Number
- List users of specific role instead of removing them with specific role
- How to bulk change user role to “No role for this site”
- Infinite Loop after Genesis Theme Upgrade
- Modify widget to output posts in custom order
- Access level seems to have gone from admin to editor
- Alternative layout the loop
- Restrict Access to the User Profile
- Why loop renders only last metabox from array? [closed]
- Cant pull in featured Image
- How to execute custom loop before loop content?
- Page gets displayed in post field
- Repeat code, change variable?
- the_content() keeps repeating itself
- Custom Looping of WordPress Posts
- Foreach loop inside foreach loop?
- Show different Google Map markers for different post_meta values
- Allow viewing the edit screen for a post type, but not make/save/publish/update changes
- how to place Post and page content side by side
- Show posts by tags excluding current post
- Add specific class to featured posts
- Adding options to loop
- Make custom WordPress comments list
- Different role for free and pro users in wordpress without using bbpress
- numberposts not responding to wp_reset_postdata()
- Echo Most Recent Sticky Post in Loop?
- Defined user role to access plugin’s pages
- Template included with plugin doesn’t return all posts for custom taxonomy
- Ajax loop and history.js for SEO
- to get a little more content after ‘read more’ inside loop
- Control what custom posts a user can see
- Extend WP_User_Query or WP_User to return all custom fields?
- Show all child categories associated to post ID within loop
- Remove posts_orderby filter then add it back in
- Subscriber role – blank page
- the_title() Returns the page title instead of the post
- Strange problem with wp_get_attachment_image_src database (db) query count
- How to include posts from one category, into a separate category of posts?
- how do i make this loop work
- Active class for my flexslider in WordPress
- Foundation modal in wordpress php loop
- Link Button url count php and wordpress
- Sorting posts to make those with post thumbnail show up first
- Best way to check if a post with specific meta exists
- ACF field not appearing correctly in loop
- How to create child/sub user under parent user
- pre_get_posts main_query not displaying after applying tax_query filters
- How create a multisite setup with “phantom” accounts and passwords?
- Archive sorted by month – separate
- WP update_post_meta link loop
- WordPress loop only displays 5 articles max?
- Limit article to 100 characters. Can’t use the_excerpt…
- Next 10 posts data of currently viewing post in blog page
- How to get only 1 role from user
- Front end login and page restriction
- Structure and Display Content from Multiple Pages on Single Page
- Creating a archive for taxonomy terms, not the term results
- User “none” role
- How to connect database table to each registered wordpress user.
- Making a specific page wordpress compatable that is not index
- Return only content in excerpt field in loop
- Ajax category pagination problem
- How do I aproach this?(for sale, for lease, sold->move something from a category to another)
- Unable to login + Redirect loop on mobile
- Change the functionality of wordpress users module in admin
- Posts are being displayed from old to new, in ascending order
- Loop in taxonomy for terms and post
- My loop of random posts drags in comments of said random post