Query String no longer working?

Hi There!

So we have been using a looper with a query string for some time, and it has been working great. On our homepage it should be showing three events and it has, but now it only shows one. We have verified we have three to show and verified the query string here:

The query string is as follows:

post_type=event-detail&meta_key=event_start_date&orderby=meta_value_num&order=ASC&meta_query%5B0%5D%5Bkey%5D=event_start_date&meta_query%5B0%5D%5Bvalue%5D={{dc:global:date format="Ymd"}}&meta_query%5B0%5D%5Bcompare%5D=%3E%3D&meta_query%5B0%5D%5Btype%5D=numeric&posts_per_page=3

It is derived from the following and replaces the event_start_date with {{dc:global:date format="Ymd"}}

$today = date('Ymd');
$meta_query[] = array(
    'key'     => 'wpcf-start-date',
    'value'   => $today,
    'compare' => '>=',
    'type' => 'numeric',
);

$query = array(
    'post_type'  => 'event-detail',
    'meta_key'   => 'wpcf-start-date',
    'orderby'    => 'meta_value_num',
    'order'      => 'ASC',
    'meta_query' => $meta_query,
    'posts_per_page' => 3
);

var_dump( http_build_query( $query ) );	

This has been working great. Did anything change on how we should create these query strings? We are up-to-date on WP and Pro.

Thank you.

Hello Michael,

Thanks for writing in!

In your query string, please change 'type' => 'numeric', to 'type' => 'date', since you are comparing the global date and the date of the event.

Kindly let us know how it goes.

Thank you, yes, I had already played with the type. This had no effect.

I left a secure note with the login if you have the time to check it out. It is a global block called Events: Home Page

Hello Michael,

I have logged in to your site and it seems that there is a JS error on the page. I am seeing this:

Please make sure that all your plugins are up to date. It most cases, out dated plugin can create issues and prevent some features from loading. Resolving this JS issue first will then allow us to investigate further related to your query issue. You may also do the following:

Kindly let us know how it goes.

Where did you see this? On the admin end? We do not see any errors.

Hey Michael,

I’m not sure about the error because I’m not getting it either.

Regarding the issue, something must have changed with the source data and not Pro. You need to experiment with what in the query is breaking the output. You can do that by starting with a simple query like this:

post_type=event-detail&posts_per_page=3

That outputs 3 of the events (see screenshot in the secure note). Add more arguments to the query. The argument that you add that breaks the query is likely the culprit. Once found, we can investigate further if this is an issue with Pro.

Thanks.

OK, yes, already started playing with it. Thank you

Hi Michael,

You are most welcome. Please let me know if you find any further problems.

So the breakdown is here:

&meta_query%5B0%5D%5Bvalue%5D={{dc:global:date format=“Ymd”}}

We have been using this is the past with no issue. Has anything changed on using this within Cornerstone?

Thank you for your assistance.

Hey Michael,

We haven’t changed anything, the meta query you added in your last reply still works. A query something like this one:

post_type=event-detail&posts_per_page=3&meta_key=event_start_date&orderby=meta_value_num&order=ASC&meta_query%5B0% 5D%5Bkey%5D={{dc:global:date format="Ymd"}}

Hope that helps.

OK, let me compare the two, so I know for the future. Thank you!

Hey Michael,

You’re welcome and let us know how it goes.

Thank you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.