Created
July 27, 2018 10:03
-
-
Save phpfiddle/58730e89be7790a9a59db8e80269ba4b to your computer and use it in GitHub Desktop.
[ Posted by Alexds ] populate assign location field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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