On this online platform project i have requested all users to add in their school title.
In the user dashboard there is a posts section which currently shows all posts. I want to only show posts that belong to users from the same school or institute.
I am working in the child theme and have possibly found out i would need:
add_filter( 'hook_into_theme', 'my_posts_filter');
I also understand, may be wrong, that i would need an array possibly. So the key is institute : value (whatever the users put it as)
$args = array(
'meta_query' => array(
array(
'key' => 'school',
'value' => $??? what do i put here $current_user->ID,
'compare' => '='
)
)
);
How would i combine the function and the array to work to filter posts to only show those from the same school??
Here is my try:
add_filter( 'theme_customisation_hook', 'my_posts_filter');
function my_posts_filter ($args) {
$args = array(
'meta_query' => array(
array(
'key' => 'school',
'value' => $current_user->ID,
'compare' => '='
)
)
);
}
Does this make any sense?