I'm new in php & WordPress in general but I searched all the stackexchange website to find the proper advice with no luck so I hope I ask in proper way.
I have simple PHP function with if statement look like this:
function wp_admin_restrection(){
if( !current_user_can('administrator') && $wpAdminRestrection ){
do something
}
}
Where $wpAdminRestrection = get_field('disable_wp_admin_for_non_admin', 'option');
My problem is, the above function not working as its written but if I write like this:
function wp_admin_restrection(){
if( !current_user_can('administrator') && get_field('disable_wp_admin_for_non_admin ){
do something
}
}
it will work with no issue.
According to ACF documentation , I should use get_field for this situation and not the_field.
Would you please advise me?
NOTE This seem to only happen with True/False field as its working fine with other fields so far.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744726200a4590193.html
评论列表(0条)