Support » Fixing WordPress » Query wp-types with Date

  • Resolved Cornelis Scheltinga

    (@cscheltinga)


    I want to compare the dates from my custom post type (created with wp-types) in my WordPress query.

    On my localhost it looked like everything was working; but now on my live server it isn’t.
    The query looks like this:

    $today = time();
        $args = array(
            'post_type' => 'films',
            'posts_per_page' => 6,
            'meta_query' => array(
                array(
                    'key' => 'wpcf-vanaf-in-het-theater',
                    'value' => $today,
                    'compare' => '<=',
                    'type' => 'NUMERIC'
                ),
                array(
                    'key' => 'wpcf-archiveren',
                    'value' => '',
                    'compare' => '=='
                )
            )
        );

    What’s going wrong?

Viewing 1 replies (of 1 total)
  • Already got it. It was the second array which causes the trouble.
    It should have ‘value’ => ‘0’, instead of ”. Strange why it worked on my localhost anyway.

Viewing 1 replies (of 1 total)
  • The topic ‘Query wp-types with Date’ is closed to new replies.