
you can generate field groups using JSON for example

for example you may try something like this in your functions.php
add_action('get_sidebar', 'special_sidebar');
function special_sidebar($sidebar) {
$new_side_bar = get_field('ACFSideBarField');
if ($new_side_bar) {
return $new_side_bar;
}
return $sidebar;
}
it will change the $name in get_sidebar($name)

function searchForName($name, $array) {
foreach ($array as $key => $val) {
if ($val['nickname'] === $name) {
return true;
}
}
return null;
}
$current_user = wp_get_current_user();
if(searchForName($current_user->user_login,get_field('YourACFUserField'))):
//CODE GOES HERE
endif;
something like that

or my favorite way… clien-side scripts =)
function stat_box(){
if (get_post_type()=='YourPostTypeSlug'){
$out = '<script type="text/javascript">';
$out .= 'var myMessage = jQuery(\'.field_type-message:contains("[stat_message_anchor]")\');if (myMessage) myMessage.html(myMessage.html().replace("[stat_message_anchor]","Lorem ipsum goes here..."))'; //changing content
$out .= '</script>';
echo $out;
}
}
add_action('in_admin_footer', 'stat_box');
and just put the text “[stat_message_anchor]” in your message

Why so complicated, are you really need this ‘Message’ field?
function stat_meta_box( $post_type, $post ) {
add_meta_box(
'stat_box',
'Summary',
function(){global $post;var_dump($post);}, // just for example
array( ), // blank or list of your post_types
'advanced' // or 'side'
);
}
add_action( 'add_meta_boxes', 'stat_meta_box', 10, 2 );
no extra queries or function chains but the same result

function remove_acf(){
remove_menu_page( 'edit.php?post_type=acf' );
}
add_action( 'admin_menu', 'remove_acf',100 );
I made this way…
add_filter('acf/settings/show_admin', '__return_false')
really not working
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.