Change WordPress user roles and capabilities Forums How to or FAQ Set Posts to manage at User level but by an ACF setting Reply To: Set Posts to manage at User level but by an ACF setting

#6707
Vladimir
Keymaster

Another suggestion –
You use get_posts() inside your filter function. URE’s uses ‘pre_get_posts’ hook to define the list of the allowed posts, thus calling get_posts() inside filter function may lead to the endless recursion and finally to the problem with available memory. So try to switch off this custom filter before to call get_posts(), then restore it back, like this:


remove_filter('ure_edit_posts_access_id_list', 'ure_edit_posts_access_set_id_list_cu'); 
$posts = get_posts(array(
			'numberposts'	=> -1,
			'post_type'		=> 'page',
			'meta_query'	=> array(
				'relation'		=> 'OR',
				array(
					'key'	 	=> 'analytics_group_name',
					'value'	  	=> $ag,
					'compare' 	=> 'IN',
				),
			),
		));
add_filter('ure_edit_posts_access_id_list', 'ure_edit_posts_access_set_id_list_cu');

If this will not help, let me know, we will try to switch off/restore directly URE’s global post edit access filter.