Query String question

Hi,

I am trying to build a looper provider using query string that uses a custom field value in the current post (an Order) to access fields from another post (Product Info). I have set the Custom Field in the Order post to return the value of the Post ID. This is the string query I am using but doesn’t seem to work…

post_type=product&post_status=publish&posts_per_page=1p={{{{dc:post:meta key=“forecast_product”}}=“post_id”}}

Can you let me know what I’m doing wrong here?

Thanks,
Darren.

Hello Darren,

Thanks for writing in! You query string is incorrect.
You should make it like this first:

$args = array(
    'post_type'  => 'product',
    'post_status' => 'publish',
    'posts_per_page' => 1,
    'p' => '{{{{dc:post:meta key="forecast_product"}}'
);
$query = new WP_Query( $args );

And then use var_dump( http_build_query( $args ) ); to get the query string. The resulting output should be displayed somewhere on top of your screen.

For reference, you can check this thread:

Kindly let us know how it goes.

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