Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6059159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:40:46+00:00 2026-05-23T08:40:46+00:00

I am grabbing posts from the WordPress database using this piece of code: $query

  • 0

I am grabbing posts from the WordPress database using this piece of code:

$query = array(
    'numberposts' => -1,
    'post_type' => 'post',
    'post_status' => 'publish'
);

$posts = get_posts($query);

I want to order the posts by a date in a custom field.

The custom field is called netr_event_date_start and contains strings formatted like YYYY-MM-DD (for example 2011-10-24).

How can this be achieved? Thanks for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:40:46+00:00Added an answer on May 23, 2026 at 8:40 am

    One idea is:

        $args=array(
          'meta_key' => 'netr_event_date_start',
          'orderby'=>'netr_event_date_start',
          'numberposts' => -1,
          'post_type' => 'post',
         'post_status' => 'publish'
      );
    
      $posts = get_posts($args);
    

    and another

       $args=array(
          'meta_key' => 'netr_event_date_start'
          'post_type' => 'post',
          'post_status' => 'publish',
          'posts_per_page' => -1,
          'caller_get_posts'=> 1,
          'orderby'=>'netr_event_date_start'
       );
    
       $my_query = null;
       $my_query = new WP_Query($args);
    
       if( $my_query->have_posts() ) {
         while ($my_query->have_posts()) : $my_query->the_post(); ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using $.post for grabbing XML content from an external PHP script and I'm
Trends data from Twitter Search API in JSON. Grabbing the file using: $jsonurl =
I'm grabbing a list of tags used on a post with the $posttags array.
Using an ajax POST request in jQuery, I get the following xml back from
I am using a MySQL database and looking to capture the top tags from
I have a query that is grabbing the Date of a given post. I'm
I'm interested in grabbing the EPG data from DVB-T streams. Does anyone know of
I am having trouble grabbing the values from the form once processed. I need
I have a xsl file that is grabbing variables from xml and they seem
There are a few APIs for grabbing the address book/contact list from the major

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.