I have the following code, it looks for me well by organization, which is a simple text area field of the ACF
but I know that you can access it in another way and with its field id, that here is attached “field_57c7fadfc5635”.
<?php
require_once("../wp-load.php");
switch_to_blog(5);
echo '
<form class="form form--search" action="" method="post">
<fieldset>
<div>
<input type="hidden" name="custom_field" value="orgranizaciones" />
<input type="search" name="s" class="search__input" placeholder="Buscar por organizaciĆ³n" />
<button type="submit" class="button button--submit">Submit</button>
</div>
</fieldset>
</form>
';
//AJAX
$args = array(
'post_type' => array( 'profesiones' ),
'posts_per_page' => -1,
'post_status' => array( 'publish' ),
'meta_key' => 'nombre_profesion',
'meta_query' => array(
array(
'relation' => 'AND',
array(
'key' => $_POST['custom_field'],
'value' => $_POST['s'],
'compare' => 'LIKE'
)
)
),
'orderby' => 'meta_value',
'order' => 'ASC',
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) :
echo '<table border="1">
<thead>
<tr>
<th>Nombre de la profesion</th>
</tr>
</thead>
<tbody>';
while ( $query->have_posts() ) :
$query->the_post();
echo '<tr>
<td><a href="'.get_the_permalink().'">'.get_field('plural').'</a></td>
</tr>';
endwhile;
echo '</tbody>
</table>';
endif;
wp_reset_query();
restore_current_blog();
?>
is placed in the code that looks for “orgranizaciones”, but what I really want to look for is the sub field personalized language, which comes from languages