Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
Created July 27, 2018 10:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phpfiddle/58730e89be7790a9a59db8e80269ba4b to your computer and use it in GitHub Desktop.
Save phpfiddle/58730e89be7790a9a59db8e80269ba4b to your computer and use it in GitHub Desktop.
[ Posted by Alexds ] populate assign location field
<!-- THIS POPULATES THE "Assign this art item to:" select box -->
<?php
function my_post_object_query( $args, $field, $post_id ) {
//query locations available only to that logged user
$args = array(
'post_type' => 'krohne_location',
'author' => get_current_user_id()
);
// $field['required'] = true;
// return
return $args;
}
// filter for a specific field based on it's name
add_filter('acf/fields/post_object/query/name=artitem_assign_location', 'my_post_object_query', 10, 3);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment