On one page on my site, I display the marital situation of my users thanks to a ‘situation’ ACF field added to each ‘user’.
For example, on on page, I used that code to get and display the situation on each user page : $cellValue = trim(esc_html($userData->situation));
2 possible values for this field are : M or F.
My need :
I’d need to filter the display of an editorial page according to the situation of the current logged in user.
To do that, I just want to add a condition in an existing PHP condition string :
“IF ‘condition A’ && ‘condition B’ && ‘condition C’ are met…”, where ‘condition C’ is the one related to ‘situation’ field.
Could you share me please a synthax example, if, let’s say, I need to filter by value F situation ? I mean : “&& ‘situation’ of the current logged in user is equal to ‘F'”
I guess there’s no need to add any function or action/hook.
I wish to filter posts, and more generally content, according to criteria of the current logged in user :
If he has *this situation*, he can see *this*…
My question is restricted to the criteria situation (which is an ACF added for each user, filled in at user subscription) :
If the value of the situation is F, so the current logged in user can see this…
And in my code, I just need the synthax to add this criteria “situation = F for the current logged in user” (starting with &&...)