Hidden field in acf

Create a field group for just that field. In the Location panel under Rules, set Show this field group if to Current User Role is equal to Administrator – that way, your users won’t see the field group but you still will (good for debugging).

Displaying user data within ACF relational field (user type)

You don’t actually need to call get_userdata(), all the data you need should be in the relational field array: EDIT: Add post ID and User ID to calls to get_field(). <?php $posts = get_sub_field(‘who_to_show’); if( $posts ): ?> <?php foreach( $posts as $post): setup_postdata($post); $user_info = get_field( ‘relational_user_field’, $post->ID ); $image = get_the_field(‘author_image’, ‘user_’.$user_info->ID ); … Read more

How to get ACF value inside Gutenberg Block from another page or template? I’m using Timber too

You’ll need to set a render callback when you create your ACF block: acf_register_block_type( array( ‘name’ => ‘example-block’, ‘title’ => __( ‘Example Block’, ‘your-text-domain’ ), ‘description’ => __( ‘A custom example block.’, ‘your-text-domain’ ), ‘render_callback’ => ‘my_acf_block_render_callback’, ‘category’ => ‘formatting’, ‘icon’ => ‘admin-comments’, ‘keywords’ => array( ‘example’ ), ) ); Then in that function you … Read more

ACF save json to custom directory not working, default acf-json used instead

the two filters don’t have the same output. you can test that add_filter(‘acf/json_directory’, function ($path) { return get_template_directory() . ‘/config/acf-json’; }); add_filter(‘acf/settings/save_json’, function ($path) { return apply_filters(“acf/json_directory”, NULL); }); add_filter(‘acf/settings/load_json’, function ($paths) { return [ apply_filters(“acf/json_directory”, NULL) ]; });

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)