I started looking into my code again and found the reason in another place.
Maybe I have some kind of error in the code that we are blocking acf functions.
add_filter(‘parse_query’, ‘ConsultationsSearchQuery’);
function ConsultationsSearchQuery($query)
{
global $pagenow;
if (is_admin() && 'edit.php' == $pagenow) {
if (
'consultations' == $_GET['post_type'] &&
isset($_GET['calendar_date_start']) &&
isset($_GET['calendar_date_finish'])) {
if ($_GET['calendar_date_start'] && !$_GET['calendar_date_finish']) {
$meta_query = array(
[
'key' => 'group_consultations_date',
'value' => $_GET['calendar_date_start'],
'compare' => '>=',
'type' => 'DATE'
],
);
}
if ($_GET['calendar_date_finish'] && !$_GET["calendar_date_start"]) {
$meta_query = array(
[
'key' => 'group_consultations_date',
'value' => $_GET['calendar_date_finish'],
'compare' => '<=',
'type' => 'DATE'
],
);
}
if ($_GET['calendar_date_start'] && $_GET['calendar_date_finish']) {
$meta_query = array(
[
'key' => 'group_consultations_date',
'value' => [$_GET['calendar_date_start'], $_GET['calendar_date_finish']],
'compare' => 'BETWEEN',
'type' => 'DATE'
],
);
}
$query->set('meta_query', $meta_query);
}
}
}
I also want to add my msg that after applying the filter, get_field() does not work
I had to use a different function get_post_meta ()
before filter
if ($colname === 'calendar_specialist') {
var_dump(get_field_object("field_653638ad2ee77",$post_id)["choices"]);
}
after filter
I get NULL
Columns: email, phone, …
The code works fine if you get the value via
if ($colname === 'calendar_user_email') {
echo get_post_meta($post_id, "group_consultations_email", true);
}
Are there any options to check differently why this works?
Dear, John Huebner!
Why does it work like this?
Structure:
1. repeater – repeater_test
$post_data = array(
'post_title' => $data["main_info"]["company"],
'post_content' => "",
'post_status' => 'publish',
'post_author' => get_current_user_id(),
"post_type" => "companies"
);
$the_record_id = wp_insert_post( $post_data );
add_row("repeater_test", ["test"=>"adding to the row should"], $the_record_id);
But it doesn’t work like this
Structure
1. field group – (group_main_info)
1.2 repeater – (phones)
add_row("group_main_info_phones", ["name"=>"Jon","phone"=>"0897654007"], $the_record_id);
I tried to write element keys and it doesn’t work the same way.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.