I am using Astra Pro Custom layouts. I have created a hook that only executes my code in specific post types. All PHP code in there works except for this except when I place it in functions.php
Does anyone know how to run this from the plugin?
Thanks
Does anyone know how to run this from the plugin?
Code:
add_action('admin_head', 'populating_your_custom_field');
add_action('wp_head', 'populating_your_custom_field');
function populating_your_custom_field(){
$your_custom_field_value = the_field("field_607aa2cb60022");
if (empty($your_custom_field_value)) {
$your_custom_field_value = "Random text for testing";
update_field("field_607aa2cb60022", $your_custom_field_value);
}
}
Thanks
Last edited: