Skip to content

Instantly share code, notes, and snippets.

@DavidCramer
Last active February 22, 2017 07:30
Show Gist options
  • Save DavidCramer/d3eed24e3ec33ba20e7c2b3c5827a7e1 to your computer and use it in GitHub Desktop.
Save DavidCramer/d3eed24e3ec33ba20e7c2b3c5827a7e1 to your computer and use it in GitHub Desktop.
Exclude administrators from DB Post Types users connection
<?php
// Add the code below to your functions.php file of your child theme.
// This removes all users that are administrators from being synced in DB Post Types
// Uses the `dbpt_source_exclude-{$slug}` filter
add_filter( 'dbpt_source_exclude-users', function () {
// return the ID's of users NOT to be synced.
return get_users( array(
'role__in' => array( 'administrator' ),
'fields' => 'ids',
) );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment