Hello I have this code, and I need have the dinamic ID from URL Custom Post Type, but just work when I try hardcoding ID.
when I try get the ID with other method I cant … just I think is the AJAX execution, but how can I solve this? …
Please somebody help me?
<?php
add_filter(‘acf/load_field/key=field_5d434f04fc249’, ‘this_screen’);
function this_screen($field) {
global $post_id;
/*Dinamic ID from URL in Dashboard WordPress*/
// $post_id = $_GET[‘post’];
/*Hardcoding ID*/
$post_id = 1663;
$get_champ = get_field( ‘liga_set_championship_on_match’, $post_id );
$get_curr_champ = $get_champ->post_name;
$set_new_champ = array( 0 => ‘championship_for_match:’ . $get_curr_champ);
$field[‘taxonomy’] = $set_new_champ;
/*Just for check the result*/
$field[‘label’] = $set_new_champ[0];
return $field;
}
?>