Offset posts in query string provider

Hello,

when I try this

$query=array(
‘post_type’ => ‘jelovnik’,
‘posts_per_page’ => 5,
‘offset’ => 5,
‘cat’ => 25
);

var_dump( http_build_query( $query ) );

string that I get show change in Cornerstone but when I try to save, there is JSON error.

What I’m doing wrong?

Best regards

Hey @ofirdoo,

Thanks for reaching out!

The issue seems to stem from the use of the incorrect quote characters in your array. PHP requires the use of straight single quotes ' or double quotes " for strings, but your code is using curly quotes and .

Here’s the corrected PHP array:

$query = array(
    'post_type' => 'jelovnik',
    'posts_per_page' => 5,
    'offset' => 5,
    'cat' => 25
);

var_dump(http_build_query($query));

Hope that helps.

Hello,

thank you for this.

Best regards

Hi Ofir,

Glad that we are able to help you.

Thanks

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