I have added a custom field (using Advanced Custom Fields plugin) to a page allowing you to show/hide it with a simple checkbox, i want to filter out these pages if a user is not logged in so i am doing the following:
if( !is_user_logged_in() ): $args = array( 'title_li' => '', 'meta_key' => 'private', 'meta_value' => 0 ); else: $args = array( 'title_li' => '', 'meta_key' => 'private', 'meta_value' => 1 ); endif; wp_list_pages($args);
So i want it to show all pages where the custom variable is 0 is not logged in and 1 if they are.
Logged in, works fine. Only shows the private pages in the menu.
Not logged in, shows all pages no matter what the value is.
I have tried adding
meta_compare and also changing
meta_value_num but neither have worked.