WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following post query:

query_posts( array(
      'post_type' => 'maze-schedule',
      'order' => 'ASC',
      'orderby' => 'meta_value_num',
      'meta_key' => 'course_date'
    ) );

This works fine and the posts are ordered by my "course_date" meta value.

However, when two posts with the same meta value for "course_date" exist - they are displayed in one order when accessing my site on a Mac, and another when accessing via a PC.

Would the OS have any effect on how the results are displayed? Im guessing WP reverts to some default order when the orderby meets two posts with the same value?

Many thanks in advance.

share|improve this question

When these two values are the same, then your orderby statement does not tell how they should be ordered.

In the SQL world, order is not an inherent property of a set of data. Thus, you get no guarantees from your RDBMS that your data will come back in a certain order -- or even in a consistent order -- unless you query your data with an ORDER BY clause.

The order may be different depending on storage engine, and so on.

PS. There is a chance that rows will be returned in ASC ID order, but it's only a chance.

share|improve this answer

Would the OS have any effect on how the results are displayed?

It depends ...

The client computer operating system can be detected by the web server through the web browser and the different results can be sent from the web server based on the client operating system.

However, the query_posts() function does not check (or react to) which client operating system is being used to make the request.

From \WordPress\wp-includes\query.php :

 * Set up The Loop with query parameters.
 * This will override the current WordPress Loop and shouldn't be used more than
 * once. This must not be used within the WordPress Loop.
 * @since 1.5.0
 * @uses $wp_query
 * @param string $query
 * @return array List of posts
function query_posts($query) {
    $GLOBALS['wp_query'] = new WP_Query();
    return $GLOBALS['wp_query']->query($query);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.