Hey guys, a new project I have the following code to fill an option, which is running normally while listing all data.
<select name="agent_id" id="agent-selectbox">
<?php
$agents_args = array( 'post_type' => 'agent', 'posts_per_page' => -1 );
$agents = get_posts( $agents_args );
foreach ( $agents as $agent ) :
?><option value="<?php echo $agent->ID; ?>" <?php if( isset($post_meta_data['themes_agents']) && ($post_meta_data['themes_agents'][0] == $agent->ID ) ){ echo "selected"; } ?>><?php echo $agent->post_title; ?></option><?php
endforeach;
?>
</select>
But, I would like to add a new parameter to query, tried adding via code, but does not work.
$agents_args = array( 'post_type' => 'agent', 'posts_per_page' => -1, 'id_usuario' => $user_id );
Recalling that the problem is not in my variable therefore contains the same data. Just do not know for PHP OO way.