Is it posssible to create a function that get the post_meta of a page based on the currentuser login and Page Title is a match?
So if user "Test1" is logged in it will get the post_meta of a Page that has the title "Test1". Only when there is a match, otherwise do nothing.
I got this function to retrieve the child of a parent and then load a field but when creating a new page there is no parent yet. That is why I want to create this new function.
function my_acf_load_field( $field ) {
global $post;
if ( 0 !== (int) $post->post_parent )
{
$some_value = get_post_meta( $post->post_parent, 'rwp_user_score', true );
if ( ! empty ( $some_value ) )
switch ( $field['name'] ) {
case 'gemiddelde_score_hosting_provider':
$field['value'] = '' . $some_value .'';
break;
}
}
return $field;
}
add_filter('acf/load_field', 'my_acf_load_field');